Further work
This commit is contained in:
parent
e78f3a4a76
commit
792750fa37
0
src/routes/posts/tags/+page.svelte
Normal file
0
src/routes/posts/tags/+page.svelte
Normal file
27
src/routes/posts/tags/[slug]/+page.server.ts
Normal file
27
src/routes/posts/tags/[slug]/+page.server.ts
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
interface PostData {
|
||||||
|
Content: ConstructorOfATypedSvelteComponent;
|
||||||
|
title: string;
|
||||||
|
date: string;
|
||||||
|
author: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
const defaultSlug = 'notFound';
|
||||||
|
|
||||||
|
export async function load({ params }) {
|
||||||
|
let post;
|
||||||
|
try {
|
||||||
|
post = await import(`../markdown/${params.slug}.md`);
|
||||||
|
} catch {
|
||||||
|
post = await import(`../markdown/${defaultSlug}.md`);
|
||||||
|
}
|
||||||
|
const { title, date, author } = post.metadata;
|
||||||
|
const Content = post.default;
|
||||||
|
|
||||||
|
const postData: PostData = {
|
||||||
|
Content,
|
||||||
|
title,
|
||||||
|
date,
|
||||||
|
author
|
||||||
|
};
|
||||||
|
return postData;
|
||||||
|
}
|
0
src/routes/posts/tags/[slug]/+page.svelte
Normal file
0
src/routes/posts/tags/[slug]/+page.svelte
Normal file
Loading…
Reference in New Issue
Block a user