95 lines
2.4 KiB
TypeScript
95 lines
2.4 KiB
TypeScript
import { listBlogDetails } from "@/data/blog-detail";
|
|
import { listAnimationSources } from "@/data/animation-sources";
|
|
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, animationSources] = await Promise.all([
|
|
listBlogDetails(),
|
|
listAnimationSources(),
|
|
]);
|
|
|
|
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}/animation-sources`,
|
|
lastModified: new Date(),
|
|
changeFrequency: "monthly",
|
|
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,
|
|
}));
|
|
|
|
const animationSourceRoutes: MetadataRoute.Sitemap = animationSources.map(
|
|
(source) => ({
|
|
url: `${SITE_URL}${source.lang === "en" ? "/en" : ""}/animation-sources/${source.slug}`,
|
|
lastModified: source.date ? new Date(source.date) : new Date(),
|
|
changeFrequency: "monthly",
|
|
priority: 0.6,
|
|
}),
|
|
);
|
|
|
|
return [...staticRoutes, ...blogRoutes, ...animationSourceRoutes];
|
|
}
|