Skip to content

Commit ae455da

Browse files
authoredJul 21, 2024··
fix: check for robots route rules (#321)
1 parent b2fd5bb commit ae455da

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed
 

‎src/runtime/nitro/sitemap/nitro.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ export async function createSitemap(e: H3Event, definition: SitemapDefinition, r
5858

5959
if (routeRules.sitemap === false)
6060
return false
61-
if (typeof routeRules.index !== 'undefined' && !routeRules.index)
61+
if ((typeof routeRules.index !== 'undefined' && !routeRules.index)
62+
// @ts-expect-error runtime types
63+
|| (typeof routeRules.robots !== 'undefined' && !routeRules.robots)
64+
) {
6265
return false
66+
}
6367
const hasRobotsDisabled = Object.entries(routeRules.headers || {})
6468
.some(([name, value]) => name.toLowerCase() === 'x-robots-tag' && value.toLowerCase().includes('noindex'))
6569
// check for redirects and headers which aren't indexable

0 commit comments

Comments
 (0)
Please sign in to comment.