Skip to content

Commit 2801b8a

Browse files
committedAug 21, 2024·
fix: avoid breaking change in `getPathRobotConfix: incorrect robot meta tag
Fixes nuxt-modules/robots/is#137sues/137
1 parent 8c605da commit 2801b8a

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed
 

Diff for: ‎src/runtime/util.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ export function normalizeGroup(group: RobotsGroupInput): RobotsGroupResolved {
191191
userAgent: group.userAgent ? asArray(group.userAgent) : ['*'],
192192
disallow,
193193
allow,
194-
_indexable: disallow.includes((rule: string) => rule === '/'),
194+
_indexable: !disallow.includes((rule: string) => rule === '/'),
195195
_rules: [
196196
...disallow.map(r => ({ pattern: r, allow: false })),
197197
...allow.map(r => ({ pattern: r, allow: true })),

Diff for: ‎test/default.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,6 @@ describe('default', () => {
3737
expect((await $fetch.raw('/users/test/hidden')).headers.get('x-robots-tag')).toMatchInlineSnapshot(`"noindex, nofollow"`)
3838
// wildcard query
3939
expect((await $fetch.raw('/visible?b=foo&a=bar')).headers.get('x-robots-tag')).toMatchInlineSnapshot(`"noindex, nofollow"`)
40+
expect((await $fetch.raw('/')).headers.get('x-robots-tag')).toMatchInlineSnapshot(`"index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1"`)
4041
})
4142
})

0 commit comments

Comments
 (0)
Please sign in to comment.