fix: add docs pages to sitemap and enable prerendering in TanStack Start

- Include Fumadocs `source.getPages()` entries in `/sitemap.xml` alongside the home and module detail URLs; drop `changefreq` from all entries and make `priority` optional
- Enable `prerender` in `tanstackStart()` with `crawlLinks: false` so static pages are pre-built without a full crawl
This commit is contained in:
2026-05-22 19:34:39 -04:00
parent e019c28faa
commit 101990843e
2 changed files with 12 additions and 17 deletions
+6 -16
View File
@@ -1,15 +1,9 @@
import type { RegistryIndex } from "@stanza/registry";
import { createFileRoute } from "@tanstack/react-router";
import { source } from "@/lib/source";
import { loadRegistryFile } from "@/server/registry-base.server";
/**
* `/sitemap.xml` — enumerates the home plus every module detail page. Search
* params (peer overrides) are intentionally excluded: the canonical URL for a
* module is the bare `/m/$slot/$id`, and the page renders an auto-default
* adapter from there. A TanStack Start server route — the origin is derived
* from the incoming request URL.
*/
export const Route = createFileRoute("/sitemap.xml")({
server: {
handlers: {
@@ -24,22 +18,18 @@ export const Route = createFileRoute("/sitemap.xml")({
}
const urls = [
{ loc: `${origin}/`, changefreq: "weekly", priority: "1.0" },
{ loc: `${origin}/`, priority: "1.0" },
...source.getPages().map((p) => ({
loc: `${origin}${p.url}`,
})),
...index.modules.map((m) => ({
loc: `${origin}/m/${m.category}/${m.id}`,
changefreq: "monthly",
priority: "0.7",
})),
];
const body = `<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
${urls
.map(
(u) =>
` <url><loc>${u.loc}</loc><changefreq>${u.changefreq}</changefreq><priority>${u.priority}</priority></url>`,
)
.join("\n")}
${urls.map((u) => ` <url><loc>${u.loc}</loc>${"priority" in u ? `<priority>${u.priority}</priority>` : ""}</url>`).join("\n")}
</urlset>
`;
+6 -1
View File
@@ -11,7 +11,12 @@ export default defineConfig({
mdx(await import("./source.config.ts")),
devtools(),
tailwindcss(),
tanstackStart(),
tanstackStart({
prerender: {
enabled: true,
crawlLinks: false,
},
}),
react(),
nitro({ serverAssets: [{ baseName: "registry", dir: "public/registry" }] }),
]),