Add blog (2)
This commit is contained in:
@@ -1,7 +1,31 @@
|
|||||||
|
import type { SeoProps } from "$lib/components/seo";
|
||||||
import { data } from "./data";
|
import { data } from "./data";
|
||||||
|
|
||||||
export async function load({ url }) {
|
export async function load({ url }) {
|
||||||
const slug = url.pathname.split("/").slice(-1)[0];
|
const slug = url.pathname.split("/").slice(-1)[0];
|
||||||
const path = `/src/routes/(main)/blog/(articles)/${slug}/+page.md`;
|
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,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import type { SeoProps } from "$lib/components/seo";
|
||||||
import { type Metadata, data } from "./(articles)/data";
|
import { type Metadata, data } from "./(articles)/data";
|
||||||
|
|
||||||
export async function load() {
|
export async function load() {
|
||||||
@@ -12,5 +13,19 @@ export async function load() {
|
|||||||
slug,
|
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,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user