Skip to content

Commit

Permalink
fix: check for robots route rules (#321)
Browse files Browse the repository at this point in the history
  • Loading branch information
harlan-zw authored Jul 21, 2024
1 parent b2fd5bb commit ae455da
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/runtime/nitro/sitemap/nitro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ export async function createSitemap(e: H3Event, definition: SitemapDefinition, r

if (routeRules.sitemap === false)
return false
if (typeof routeRules.index !== 'undefined' && !routeRules.index)
if ((typeof routeRules.index !== 'undefined' && !routeRules.index)
// @ts-expect-error runtime types
|| (typeof routeRules.robots !== 'undefined' && !routeRules.robots)
) {
return false
}
const hasRobotsDisabled = Object.entries(routeRules.headers || {})
.some(([name, value]) => name.toLowerCase() === 'x-robots-tag' && value.toLowerCase().includes('noindex'))
// check for redirects and headers which aren't indexable
Expand Down

0 comments on commit ae455da

Please sign in to comment.