Skip to content

Commit be5f7ec

Browse files
committedAug 19, 2024·
fix: avoid breaking change in getPathRobotConfig
Fixes #137
1 parent 0e1b3d6 commit be5f7ec

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed
 

‎src/runtime/nitro/composables/getPathRobotConfig.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { matchPathToRule, normaliseRobotsRouteRule } from '../../util'
77
import { useRuntimeConfig } from '#imports'
88
import { getSiteRobotConfig } from '#internal/nuxt-robots'
99

10-
export function getPathRobotConfig(e: H3Event, options?: { userAgent?: string, skipSiteIndexable?: boolean, path?: string }) {
10+
export function getPathRobotConfig(e: H3Event, options?: { userAgent?: string, skipSiteIndexable?: boolean, path?: string }): { rule: string, indexable: boolean, debug?: { source: string, line: string }} {
1111
// has already been resolved
1212
const { robotsDisabledValue, robotsEnabledValue, usingNuxtContent } = useRuntimeConfig()['nuxt-robots']
1313
if (!options?.skipSiteIndexable) {
@@ -38,7 +38,7 @@ export function getPathRobotConfig(e: H3Event, options?: { userAgent?: string, s
3838
if (robotsTxtRule) {
3939
if (!robotsTxtRule.allow) {
4040
return {
41-
allow: false,
41+
indexable: false,
4242
rule: robotsDisabledValue,
4343
debug: {
4444
source: '/robots.txt',
@@ -54,7 +54,7 @@ export function getPathRobotConfig(e: H3Event, options?: { userAgent?: string, s
5454
// 2. nuxt content rules
5555
if (usingNuxtContent && nitroApp._robots?.nuxtContentUrls?.has(withoutTrailingSlash(path))) {
5656
return {
57-
allow: false,
57+
indexable: false,
5858
rule: robotsDisabledValue,
5959
debug: {
6060
source: 'Nuxt Content',
@@ -67,15 +67,15 @@ export function getPathRobotConfig(e: H3Event, options?: { userAgent?: string, s
6767
const routeRules = normaliseRobotsRouteRule(nitroApp._robotsRuleMactcher(path))
6868
if (routeRules) {
6969
return {
70-
allow: routeRules.allow,
70+
indexable: routeRules.allow,
7171
rule: routeRules.rule || (routeRules.allow ? robotsEnabledValue : robotsDisabledValue),
7272
debug: {
7373
source: 'Route Rules',
7474
},
7575
}
7676
}
7777
return {
78-
allow: true,
78+
indexable: true,
7979
rule: robotsEnabledValue,
8080
}
8181
}

0 commit comments

Comments
 (0)
Please sign in to comment.