diff --git a/docusaurus.config.ts b/docusaurus.config.ts index 3c5ec045..8dc2007a 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -129,6 +129,68 @@ const config = (async (): Promise => { beforeDefaultRehypePlugins: [rehypeShikiPlugin], rehypePlugins: [rehypeNameToId], }, + sitemap: { + changefreq: 'weekly', + priority: 0.5, + filename: 'sitemap.xml', + createSitemapItems: async (params) => { + const { defaultCreateSitemapItems, ...rest } = params; + const items = await defaultCreateSitemapItems(rest); + return items.map((item) => { + // Use pathname so priorities work on deploy previews too + const path = new URL(item.url).pathname; + + // Homepage — highest priority + if (path === '/') { + return { ...item, priority: 1.0, changefreq: 'daily' }; + } + + // v2 docs (current, no version prefix) — high priority + if (path.startsWith('/docs/') && !path.startsWith('/docs/v1/') && !path.startsWith('/docs/0.82/')) { + if ( + path === '/docs/' || + path.startsWith('/docs/quickstart/') || + path.startsWith('/docs/overview/') + ) { + return { ...item, priority: 0.9, changefreq: 'weekly' }; + } + return { ...item, priority: 0.8, changefreq: 'weekly' }; + } + + // Blog posts — high priority + if (path.startsWith('/blog/') || path === '/blog/') { + if (path === '/blog/' || path === '/blog') { + return { ...item, priority: 0.8, changefreq: 'daily' }; + } + if (path.startsWith('/blog/page/') || path.startsWith('/blog/tags/')) { + return { ...item, priority: 0.3, changefreq: 'weekly' }; + } + return { ...item, priority: 0.7, changefreq: 'monthly' }; + } + + // Community meeting notes + if (path.startsWith('/community/') || path === '/community/') { + if (path === '/community/' || path === '/community') { + return { ...item, priority: 0.7, changefreq: 'weekly' }; + } + return { ...item, priority: 0.5, changefreq: 'weekly' }; + } + + // v1 docs — deprioritized + if (path.startsWith('/docs/v1/')) { + return { ...item, priority: 0.3, changefreq: 'monthly' }; + } + + // 0.82 docs — already disallowed in robots.txt, minimal priority + if (path.startsWith('/docs/0.82/')) { + return { ...item, priority: 0.1, changefreq: 'yearly' }; + } + + // Everything else (standalone pages like /contact, etc.) + return { ...item, priority: 0.5, changefreq: 'monthly' }; + }); + }, + }, theme: { customCss: [require.resolve('./src/styles/index.css')], },