feat: make blog post pages statically-generated

This commit is contained in:
Dorian Niemiec 2024-09-07 14:05:37 +02:00
parent 62d5ccbb6d
commit 1e935d3aef

View file

@ -66,7 +66,7 @@ export async function generateMetadata({
{
url: data.titleImage
? urlFor(data.titleImage).url()
: "/blog-missing.png",
: "https://svrjs.vercel.app/blog-missing.png",
width: 800,
height: 600,
alt: `${data.title} - SVR.JS`
@ -79,7 +79,9 @@ export async function generateMetadata({
title: `${data.title} - SVR.JS`,
description: data.smallDescription,
images: [
data.titleImage ? urlFor(data.titleImage).url() : "/blog-missing.png"
data.titleImage
? urlFor(data.titleImage).url()
: "https://svrjs.vercel.app/blog-missing.png"
],
creator: "@SVR_JS"
}
@ -208,3 +210,13 @@ export default async function BlogSlugArticle({
</>
);
}
export async function generateStaticParams() {
const query = `*[_type == 'blog']{
"slug": slug.current,
}`;
const slugsRaw = await client.fetch(query);
return slugsRaw;
}