aboutsummaryrefslogtreecommitdiff
path: root/src/pages/blog
diff options
context:
space:
mode:
authorAndrew Lee <alee14498@protonmail.com>2024-01-24 22:50:02 -0500
committerAndrew Lee <alee14498@protonmail.com>2024-01-24 23:17:14 -0500
commit5fab0381b308eb5a1c837ffdd5e0ddd757e769d3 (patch)
tree2a08add3e122f2d1fc91d30908e37a7df46ceaa8 /src/pages/blog
parent2c37ad34e91893596547060e0ab6bd320ef31bde (diff)
downloadpersonal-website-5fab0381b308eb5a1c837ffdd5e0ddd757e769d3.tar.gz
personal-website-5fab0381b308eb5a1c837ffdd5e0ddd757e769d3.tar.bz2
personal-website-5fab0381b308eb5a1c837ffdd5e0ddd757e769d3.zip
Starting to work on blog
Diffstat (limited to 'src/pages/blog')
-rw-r--r--src/pages/blog/[...slug].astro22
-rw-r--r--src/pages/blog/index.astro8
2 files changed, 30 insertions, 0 deletions
diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro
new file mode 100644
index 0000000..7db75bb
--- /dev/null
+++ b/src/pages/blog/[...slug].astro
@@ -0,0 +1,22 @@
+---
+import Page from '../../layouts/BlogPost.astro';
+import { getEntry } from 'astro:content';
+const { slug } = Astro.params;
+
+if (slug === undefined) {
+ throw new Error('Slug is required');
+}
+
+const entry = await getEntry('blog', slug);
+
+if(entry === undefined) {
+ return Astro.redirect('/404');
+}
+
+const { Content } = await entry.render();
+---
+<Page title={entry.data.title} description={entry.data.description}>
+ <main>
+ <Content />
+ </main>
+</Page>
diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro
new file mode 100644
index 0000000..556be15
--- /dev/null
+++ b/src/pages/blog/index.astro
@@ -0,0 +1,8 @@
+---
+import Page from "../../layouts/Page.astro";
+---
+<Page title="Blog" description="Where I post can be anything!">
+ <main>
+
+ </main>
+</Page>