Add blog (2)

This commit is contained in:
2025-02-10 19:00:38 +09:00
parent 3cfdcd1fe2
commit 32ab632f0a
2 changed files with 41 additions and 2 deletions

View File

@@ -1,7 +1,31 @@
import type { SeoProps } from "$lib/components/seo";
import { data } from "./data";
export async function load({ url }) {
const slug = url.pathname.split("/").slice(-1)[0];
const path = `/src/routes/(main)/blog/(articles)/${slug}/+page.md`;
return { ...data[path].metadata, slug };
const metadata = data[path].metadata;
return {
...metadata,
slug,
seo: {
title: `${metadata.title} - cannorin.net`,
description: metadata.description,
openGraph: {
title: `${metadata.title} - cannorin.net`,
type: "article",
description: metadata.description,
article: {
published_time: metadata.date,
author: ["cannorin"],
tag: [metadata.category, ...(metadata.tags ?? [])],
},
},
twitter: {
title: `${metadata.title} - cannorin.net`,
description: metadata.description,
card: "summary",
},
} as SeoProps,
};
}

View File

@@ -1,3 +1,4 @@
import type { SeoProps } from "$lib/components/seo";
import { type Metadata, data } from "./(articles)/data";
export async function load() {
@@ -12,5 +13,19 @@ export async function load() {
slug,
});
}
return { posts };
return {
posts,
seo: {
title: "blog - cannorin.net",
description: "cannorin's blog",
openGraph: {
title: "blog - cannorin.net",
description: "cannorin's blog",
},
twitter: {
title: "blog - cannorin.net",
description: "cannorin's blog",
},
} as SeoProps,
};
}