diff --git a/src/routes/[slug]/+page.svelte b/src/routes/[slug]/+page.svelte new file mode 100644 index 0000000..01112a0 --- /dev/null +++ b/src/routes/[slug]/+page.svelte @@ -0,0 +1,9 @@ + + +
+

{data.title}

+

Published: {data.date}

+ +
diff --git a/src/routes/[slug]/+page.ts b/src/routes/[slug]/+page.ts new file mode 100644 index 0000000..2cbe772 --- /dev/null +++ b/src/routes/[slug]/+page.ts @@ -0,0 +1,11 @@ +export async function load({ params }) { + const post = await import(`../posts/${params.slug}.md`); + const { title, date } = post.metadata; + const content = post.default; + + return { + content, + title, + date + }; +} diff --git a/src/routes/posts/+page.svelte b/src/routes/posts/+page.svelte new file mode 100644 index 0000000..b79fff2 --- /dev/null +++ b/src/routes/posts/+page.svelte @@ -0,0 +1,16 @@ + + + diff --git a/src/routes/posts/+page.ts b/src/routes/posts/+page.ts new file mode 100644 index 0000000..4f4c4b5 --- /dev/null +++ b/src/routes/posts/+page.ts @@ -0,0 +1,18 @@ +export async function load() { + const allPostFiles = import.meta.glob('/src/routes/posts/*.md'); + const iterablePostFiles = Object.entries(allPostFiles); + + const posts = await Promise.all( + iterablePostFiles.map(async ([path, resolver]) => { + const { metadata } = await resolver(); + const postPath = path.slice(11, -3); + + return { + meta: metadata, + path: postPath + }; + }) + ); + + return { posts }; +} diff --git a/src/routes/posts/test.md b/src/routes/posts/test.md new file mode 100644 index 0000000..4f6e419 --- /dev/null +++ b/src/routes/posts/test.md @@ -0,0 +1,4 @@ +--- +title: foo +date: 2023 +--- diff --git a/static/profile.2022.12.avif b/static/profile.2022.12.avif deleted file mode 100644 index 5030a6c..0000000 Binary files a/static/profile.2022.12.avif and /dev/null differ diff --git a/static/profile.2022.12.jpeg b/static/profile.2022.12.jpeg deleted file mode 100644 index b83a1d8..0000000 Binary files a/static/profile.2022.12.jpeg and /dev/null differ diff --git a/static/profile.2022.12.webp b/static/profile.2022.12.webp deleted file mode 100644 index 86af945..0000000 Binary files a/static/profile.2022.12.webp and /dev/null differ