svrjs-nextjs-website/app/sitemap.ts
Cypro Freelance 1435cbb397 some stuffs
2024-08-24 09:58:25 +05:30

30 lines
686 B
TypeScript

import { getAllBlogPostSlugs } from "@/lib/getBlogPost";
export default async function sitemap() {
const blogPostSlugs = await getAllBlogPostSlugs();
const baseRoutes = [
"/",
"/blog",
"/changelogs",
"/contact",
"/contribute",
"/downloads",
"/forum",
"/mods",
"/privacy-policy",
"/tos",
"/vulnerabilities",
"/newsletter",
].map((route) => ({
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}`,
lastModified: new Date().toISOString().split("T")[0],
}));
return [...baseRoutes, ...blogRoutes];
}