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:
@@ -21,8 +21,30 @@ const frutiger = localFont({
|
||||
});
|
||||
|
||||
export const metadata: Metadata = {
|
||||
metadataBase: new URL("https://blog.gabrielkaszewski.dev"),
|
||||
title: {
|
||||
default: "Gabriel Kaszewski's Blog",
|
||||
template: `%s | Gabriel's Kaszewski Blog`,
|
||||
},
|
||||
description:
|
||||
"A personal blog by Gabriel Kaszewski about technology, programming, and game development.",
|
||||
openGraph: {
|
||||
title: "Gabriel Kaszewski's Blog",
|
||||
description: "A personal blog by Gabriel Kaszewski",
|
||||
description:
|
||||
"A personal blog about technology, programming, and game development.",
|
||||
url: "https://blog.gabrielkaszewski.dev",
|
||||
siteName: "Gabriel Kaszewski's Blog",
|
||||
locale: "en_US",
|
||||
type: "website",
|
||||
images: [
|
||||
{
|
||||
url: "/default-og-image.avif",
|
||||
width: 1200,
|
||||
height: 630,
|
||||
alt: "Gabriel Kaszewski's Blog",
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
export default function RootLayout({
|
||||
|
15
app/robots.tsx
Normal file
15
app/robots.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import { MetadataRoute } from "next";
|
||||
|
||||
export default function robots(): MetadataRoute.Robots {
|
||||
const baseUrl = "https://blog.gabrielkaszewski.dev";
|
||||
|
||||
return {
|
||||
rules: [
|
||||
{
|
||||
userAgent: "*",
|
||||
allow: "/",
|
||||
},
|
||||
],
|
||||
sitemap: `${baseUrl}/sitemap.xml`,
|
||||
};
|
||||
}
|
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];
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB |
BIN
public/default-og-image.avif
Normal file
BIN
public/default-og-image.avif
Normal file
Binary file not shown.
After Width: | Height: | Size: 65 KiB |
Reference in New Issue
Block a user