Skip to content

Commit 34ab5d0

Browse files
committed
feat: add sitemap
1 parent c63a9ce commit 34ab5d0

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

apps/website/src/app/sitemap.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import type { MetadataRoute } from "next";
2+
import { allDocs, normalizePath } from "@/utils/docs";
3+
4+
const baseUrl = "https://code-blocks.pheralb.dev";
5+
6+
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
7+
const staticPages: MetadataRoute.Sitemap = [
8+
{
9+
url: baseUrl,
10+
lastModified: new Date(),
11+
changeFrequency: "monthly",
12+
priority: 1,
13+
},
14+
];
15+
16+
const docPages: MetadataRoute.Sitemap = allDocs.map((doc) => ({
17+
url: `${baseUrl}/docs/${doc.folder}/${normalizePath(doc._meta.path)}`,
18+
lastModified: new Date(),
19+
changeFrequency: "weekly" as const,
20+
priority: 0.8,
21+
}));
22+
23+
return [...staticPages, ...docPages];
24+
}

0 commit comments

Comments
 (0)