get routing working, add index for poetry, list first 6 poems on index, let each take you to their page with the poem's content

This commit is contained in:
2024-05-16 02:52:32 -04:00
parent 2cf484aa46
commit 3d22344e7f
44 changed files with 1134 additions and 178 deletions

View File

@@ -0,0 +1,18 @@
import type { Metadata } from '$lib/utils/index.js';
export async function load({ params }) {
const post = await import(`../../../../posts/poetry/${params.slug}.md`);
const { title, date, categories } = post.metadata as Metadata;
const Content = post.default;
const parsedDate = new Date(date.slice(0, date.length - 6));
const validDate = `${
parsedDate.getMonth() + 1
}/${parsedDate.getDate()}/${parsedDate.getFullYear()}`;
return {
Content,
title,
date: validDate,
categories
};
}