From 7df479156d0ad0b2a7b74a38c6e82543b527530c Mon Sep 17 00:00:00 2001 From: Ali Hesari Date: Sun, 30 Aug 2026 20:50:26 +0200 Subject: [PATCH] feat(docs): serve /docs/sitemap.xml from the page tree --- app/sitemap.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 app/sitemap.ts diff --git a/app/sitemap.ts b/app/sitemap.ts new file mode 100644 index 0000000..c4eba69 --- /dev/null +++ b/app/sitemap.ts @@ -0,0 +1,14 @@ +import type { MetadataRoute } from 'next'; +import { source } from '@/lib/source'; +import { pageUrl } from '@/lib/markdown'; + +// basePath applies to the route itself, so this is served at /docs/sitemap.xml. +export const revalidate = false; + +export default function sitemap(): MetadataRoute.Sitemap { + return source.getPages().map((page) => ({ + url: pageUrl(page), + changeFrequency: 'weekly', + priority: page.url === '/' ? 1 : 0.7, + })); +}