Generate a sitemap and prerender pages
Build sitemap XML and prerender routes from content without maintaining another route list.
Install Nuxt Sitemap, set the deployed site URL, and enable Ginko's sitemap source:
pnpm add @nuxtjs/sitemapexport default defineNuxtConfig({
modules: [
'@lupinum/ginko-content',
'@nuxtjs/sitemap'
],
site: {
url: 'https://example.com'
},
content: {
sitemap: true
}
})Ginko uses the same content routes for sitemap entries and prerender discovery, then filters each output independently. A sitemap opt-out does not remove a route from prerendering.
Limit the XML source to specific collections when some route-backed content should not appear in search-engine sitemaps:
content: {
sitemap: {
include: ['docs', 'posts'],
exclude: ['internal']
}
}Control which pages appear
- Page collections are included.
- Data collections are left out.
- Partials are always left out.
- Drafts are left out in production by default.
- Set
sitemap: falseon a collection to remove all of its URLs from XML. - Set
sitemap: falsein a page's frontmatter to drop that URL from XML. - Locale variants are emitted as alternates of the same page.
Sitemap opt-outs affect XML only. Eligible public routes can still be prerendered.
Keep application routes in Nuxt
Define translated slugs for hand-built pages in Nuxt I18n's i18n.pages. Ginko owns content URLs. Do not copy either set into another sitemap.urls or prerender array.
Reject incomplete sitemap output
Run assertions after @nuxtjs/sitemap writes the final XML. This example rejects an empty or undersized sitemap and requires both collections to contribute routes:
content: {
sitemap: {
include: ['docs', 'posts'],
assert: {
enabled: true,
mode: 'generate',
minUrlsPerSitemap: 10,
requiredCollections: ['docs', 'posts']
}
}
}mode accepts 'generate', 'build', or 'both'. Use sitemaps for per-sitemap overrides such as en-US. Set allowEmpty only for a sitemap that is intentionally allowed to contain no URLs.
Localized builds usesitemap_index.xml. Multi-sitemap output containssitemap_index.xmlplus per-locale files. A Node preview can redirect/sitemap.xmlto the index, but a static host cannot. Submit/sitemap_index.xmlor configure an explicit host redirect. Do not copy the index tositemap.xml.