All checks were successful
Build and Deploy Blog / build-and-deploy-local (push) Successful in 36s
27 lines
652 B
TypeScript
27 lines
652 B
TypeScript
import { MetadataRoute } from "next";
|
|
import { getSortedPostsData } from "@/lib/posts";
|
|
|
|
export default function sitemap(): MetadataRoute.Sitemap {
|
|
const baseUrl = "https://blog.gabrielkaszewski.dev";
|
|
|
|
const posts = getSortedPostsData();
|
|
|
|
const postUrls = posts.map((post) => ({
|
|
url: `${baseUrl}/${post.id}`,
|
|
lastModified: new Date(post.date).toISOString(),
|
|
changeFrequency: "monthly" as const,
|
|
priority: 0.8,
|
|
}));
|
|
|
|
const staticUrls = [
|
|
{
|
|
url: baseUrl,
|
|
lastModified: new Date().toISOString(),
|
|
changeFrequency: "weekly" as const,
|
|
priority: 1.0,
|
|
},
|
|
];
|
|
|
|
return [...staticUrls, ...postUrls];
|
|
}
|