|
1 | 1 | import type { MetadataRoute } from "next"; |
2 | | - |
3 | 2 | import { getAllRFSData } from "@/app/agents/utils/get-rfs-data"; |
4 | 3 | import { PATHS } from "@/constants/paths"; |
5 | 4 | import { BASE_URL } from "@/constants/site-metadata"; |
6 | 5 |
|
7 | 6 | export default async function sitemap(): Promise<MetadataRoute.Sitemap> { |
8 | | - const staticRoutes = getStaticRoutes(); |
9 | | - const agentRoutes = await getAgentRoutes(); |
10 | | - |
11 | | - return [...staticRoutes, ...agentRoutes]; |
12 | | -} |
13 | | - |
14 | | -const lastModified = new Date(); |
| 7 | + const lastModified = new Date(); |
15 | 8 |
|
16 | | -function getStaticRoutes() { |
17 | | - return Object.values(PATHS).map(({ path }) => ({ |
| 9 | + const staticRoutes = Object.values(PATHS).map(({ path }) => ({ |
18 | 10 | url: `${BASE_URL}${path}`, |
19 | 11 | lastModified, |
20 | 12 | changeFrequency: "weekly" as const, |
21 | 13 | priority: path === "/" ? 1 : 0.8, |
22 | 14 | })); |
23 | | -} |
24 | 15 |
|
25 | | -async function getAgentRoutes() { |
26 | 16 | const allRFSData = await getAllRFSData(); |
27 | | - |
28 | | - return allRFSData.map(({ slug }) => ({ |
| 17 | + const agentRoutes = allRFSData.map(({ slug }) => ({ |
29 | 18 | url: `${BASE_URL}${PATHS.AGENTS.path}/${slug}`, |
30 | 19 | lastModified, |
31 | 20 | changeFrequency: "weekly" as const, |
32 | 21 | priority: 0.7, |
33 | 22 | })); |
| 23 | + |
| 24 | + return [...staticRoutes, ...agentRoutes]; |
34 | 25 | } |
0 commit comments