svrjs-nextjs-website/app/sitemap.ts

31 lines
686 B
TypeScript
Raw Normal View History

2024-08-24 06:28:25 +02:00
import { getAllBlogPostSlugs } from "@/lib/getBlogPost";
2024-07-28 17:20:53 +02:00
export default async function sitemap() {
2024-08-24 06:28:25 +02:00
const blogPostSlugs = await getAllBlogPostSlugs();
const baseRoutes = [
"/",
2024-07-28 17:20:53 +02:00
"/blog",
"/changelogs",
"/contact",
"/contribute",
"/downloads",
"/forum",
"/mods",
"/privacy-policy",
"/tos",
"/vulnerabilities",
2024-08-24 06:28:25 +02:00
"/newsletter",
2024-07-28 17:20:53 +02:00
].map((route) => ({
2024-08-24 06:28:25 +02:00
url: `https://svrjs.vercel.app${route}`,
lastModified: new Date().toISOString().split("T")[0],
}));
const blogRoutes = blogPostSlugs.map((slug) => ({
url: `https://svrjs.vercel.app/blog/${slug.slug}`,
2024-07-28 17:20:53 +02:00
lastModified: new Date().toISOString().split("T")[0],
}));
2024-08-24 06:28:25 +02:00
return [...baseRoutes, ...blogRoutes];
2024-07-28 17:20:53 +02:00
}