SEO: sitemap construction filter uses isPathAllowed + pathOf (same rule as isPathVisibleIn)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
Radosław Smoliński
2026-10-22 17:29:49 +02:00
co-authored by Claude Opus 5.5
parent da3a0c9a85
commit f65c6580e1
+4 -3
View File
@@ -15,7 +15,7 @@ import type { PageMetadata, RobotsOptions, RobotsRules, SitemapEntry, SitemapRou
import { getAnalyticsConfig } from '../analytics/getAnalyticsConfig.js'
import { getConsentTexts } from '../consent/getConsentTexts.js'
import { normalizePath } from '../construction/logic.js'
import { isPathAllowed } from '../construction/logic.js'
import { pathOf } from '../construction/visibility.js'
import { createMarkdownRoute } from '../content/createMarkdownRenderer.js'
import { getArchiveEntries, resolveRoute as resolveRouteRaw } from '../content/index.js'
@@ -457,9 +457,10 @@ export function createContentHelpers({
})
// Under construction: list only the pages visitors can still open — the
// rest redirect to the homepage notice, which crawlers would index.
// Same check as isPathVisibleIn(mode, pathOf(url)) (security-perf branch), with the
// mode read once for the whole list.
const open = await constructionPaths()
const allowed = open ? new Set(open.map(normalizePath)) : null
const visible = allowed ? entries.filter((e) => allowed.has(normalizePath(pathOf(e.url)))) : entries
const visible = open ? entries.filter((e) => isPathAllowed(pathOf(e.url), open)) : entries
return transformSitemap ? await transformSitemap(visible) : visible
} catch (error) {
// At runtime a failure is an error (the sitemap route answers 503, so