31 lines
1.6 KiB
TypeScript
31 lines
1.6 KiB
TypeScript
import { listBlogDetails } from "@/data/blog-detail";
|
|
import type { MetadataRoute } from "next";
|
|
|
|
const SITE_URL = process.env.NEXT_PUBLIC_SITE_URL || "https://poyrazavsever.com";
|
|
|
|
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
|
const posts = await listBlogDetails();
|
|
|
|
const staticRoutes: MetadataRoute.Sitemap = [
|
|
{ url: SITE_URL, lastModified: new Date(), changeFrequency: "weekly", priority: 1.0 },
|
|
{ url: `${SITE_URL}/about`, lastModified: new Date(), changeFrequency: "monthly", priority: 0.8 },
|
|
{ url: `${SITE_URL}/about/references`, lastModified: new Date(), changeFrequency: "monthly", priority: 0.5 },
|
|
{ url: `${SITE_URL}/about/volunteer-community`, lastModified: new Date(), changeFrequency: "monthly", priority: 0.5 },
|
|
{ url: `${SITE_URL}/blog`, lastModified: new Date(), changeFrequency: "weekly", priority: 0.9 },
|
|
{ url: `${SITE_URL}/projects`, lastModified: new Date(), changeFrequency: "monthly", priority: 0.8 },
|
|
{ url: `${SITE_URL}/content`, lastModified: new Date(), changeFrequency: "weekly", priority: 0.7 },
|
|
{ url: `${SITE_URL}/contact`, lastModified: new Date(), changeFrequency: "yearly", priority: 0.5 },
|
|
{ url: `${SITE_URL}/links`, lastModified: new Date(), changeFrequency: "monthly", priority: 0.4 },
|
|
{ url: `${SITE_URL}/snippets`, lastModified: new Date(), changeFrequency: "weekly", priority: 0.7 },
|
|
];
|
|
|
|
const blogRoutes: MetadataRoute.Sitemap = posts.map((post) => ({
|
|
url: `${SITE_URL}/blog/${post.slug}`,
|
|
lastModified: post.date ? new Date(post.date) : new Date(),
|
|
changeFrequency: "monthly",
|
|
priority: 0.7,
|
|
}));
|
|
|
|
return [...staticRoutes, ...blogRoutes];
|
|
}
|