Skip to content

Commit 56af21c

Browse files
committed
fix(landing): read a max-* limit's none as a limit, not a noindex
max-image-preview:none only turns off image previews; the noindex fallback matched its trailing :none and would have kept / out of the index when such a header also carried an unknown directive. A noindex or none now counts alone or after a crawler name, never as a max-* limit's value.
1 parent b8438a0 commit 56af21c

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

‎apps/sim/lib/website/homepage.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ describe('fetchWebsiteHomepage', () => {
9696
['googlebot: noindex', 'noindex'],
9797
['googlebot: none', 'noindex'],
9898
['index, unavailable_after: 2027-01-01', null],
99+
['max-image-preview:none, unavailable_after: 2027-01-01', null],
99100
['noindex\nSet-Cookie: x=1', null],
100101
])(
101102
'passes on the website indexing directives when all are known, and a noindex in any case: %j',

‎apps/sim/lib/website/homepage.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,11 @@ const ROBOTS_DIRECTIVES = new Set([
7676
])
7777
const ROBOTS_LIMIT_DIRECTIVE = /^max-(?:snippet|image-preview|video-preview):[a-z0-9-]+$/
7878

79-
/** A `noindex` or `none`, alone or scoped to one crawler (`googlebot: noindex`). */
80-
const NOINDEX_DIRECTIVE = /(?:^|[\s:])(?:noindex|none)$/
79+
/**
80+
* A `noindex` or `none`, alone or scoped to one crawler (`googlebot: noindex`); the value of a
81+
* `max-*:` limit (`max-image-preview:none`) is not one.
82+
*/
83+
const NOINDEX_DIRECTIVE = /^(?:(?!max-)[\w-]+:\s*)?(?:noindex|none)$/
8184

8285
/**
8386
* The website's `X-Robots-Tag` when every directive in it is a known one, so its indexing choice

0 commit comments

Comments
 (0)