-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsitemap.ts
32 lines (29 loc) · 884 Bytes
/
sitemap.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import type { ParseRoute } from "@tanstack/react-router";
import type { Sitemap } from "tanstack-router-sitemap";
import type { routeTree } from "@/routeTree.gen";
// This will become a string literal union of all your routes
type MyRoutes = ParseRoute<typeof routeTree>["fullPath"];
// Define your sitemap
export const sitemap: Sitemap<MyRoutes> = {
siteUrl: "https://tss-blog-starter.pages.dev",
defaultPriority: 0.5,
routes: {
"/": {
priority: 1,
changeFrequency: "daily",
},
"/blog": {
priority: 1,
changeFrequency: "daily",
},
// Dynamic route example
"/blog/$slug": async () => {
const { allPosts } = await import("./.content-collections/generated");
return allPosts.map((post) => ({
path: `/blog/${post._meta.path}`,
priority: 0.8,
changeFrequency: "daily",
}));
},
},
};