Enhance blog metadata and SEO with structured Open Graph data; add sitemap and robots.txt functionality; replace default OG image.
All checks were successful
Build and Deploy Blog / build-and-deploy-local (push) Successful in 36s
All checks were successful
Build and Deploy Blog / build-and-deploy-local (push) Successful in 36s
This commit is contained in:
26
app/sitemap.tsx
Normal file
26
app/sitemap.tsx
Normal file
@@ -0,0 +1,26 @@
|
||||
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];
|
||||
}
|
Reference in New Issue
Block a user