forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsitemap.ts
More file actions
29 lines (25 loc) · 816 Bytes
/
Copy pathsitemap.ts
File metadata and controls
29 lines (25 loc) · 816 Bytes
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
import type { MetadataRoute } from "next";
import { source } from "./source";
export const revalidate = false;
const baseUrl =
process.env.NODE_ENV === "development" || !process.env.VERCEL_URL
? new URL("http://localhost:3000")
: new URL(`https://${process.env.VERCEL_URL}`);
export default function sitemap(): MetadataRoute.Sitemap {
const url = (path: string): string => new URL(path, baseUrl).toString();
return [
{
url: url("/"),
changeFrequency: "monthly",
priority: 1,
},
...source.getPages().map<MetadataRoute.Sitemap[number]>((page) => ({
url: url(page.url),
lastModified: (page.data as any).lastModified
? new Date((page.data as any).lastModified)
: undefined,
changeFrequency: "weekly",
priority: 0.5,
})),
];
}