aboutsummaryrefslogtreecommitdiff
path: root/apps/website/src/pages/blog
diff options
context:
space:
mode:
authorPauline <git@ethanlibs.co>2023-11-26 22:55:04 -0500
committerPauline <git@ethanlibs.co>2023-11-26 22:55:04 -0500
commit181547a25213bee8a20002e07344b957386c4d0f (patch)
tree1e1b4815166342406026478c00604cdd65e64660 /apps/website/src/pages/blog
parent955e820f1ccb59467a4f27c5c77738a7ebff193e (diff)
downloadNexus-181547a25213bee8a20002e07344b957386c4d0f.tar.gz
Nexus-181547a25213bee8a20002e07344b957386c4d0f.tar.bz2
Nexus-181547a25213bee8a20002e07344b957386c4d0f.zip
feat(build): transfer everything to esm/ts
Diffstat (limited to 'apps/website/src/pages/blog')
-rw-r--r--apps/website/src/pages/blog/[...slug].astro25
-rw-r--r--apps/website/src/pages/blog/index.astro30
2 files changed, 55 insertions, 0 deletions
diff --git a/apps/website/src/pages/blog/[...slug].astro b/apps/website/src/pages/blog/[...slug].astro
new file mode 100644
index 0000000..d9995e7
--- /dev/null
+++ b/apps/website/src/pages/blog/[...slug].astro
@@ -0,0 +1,25 @@
+---
+// i hate u astro vscode extensi on/j
+/// <reference types="../../env.d.ts" />
+import { type CollectionEntry, getCollection } from 'astro:content';
+import BlogPost from '../../layouts/BlogPost.astro';
+
+export async function getStaticPaths() {
+ const posts = await getCollection('blog');
+ return posts.map(post => ({
+ params: { slug: post.slug },
+ props: post,
+ }));
+}
+
+type Props = CollectionEntry<'blog'>;
+
+const post = Astro.props;
+const { Content } = await post.render();
+---
+
+<BlogPost {...post.data}>
+ <Content />
+</BlogPost>
+
+
diff --git a/apps/website/src/pages/blog/index.astro b/apps/website/src/pages/blog/index.astro
new file mode 100644
index 0000000..c8f8203
--- /dev/null
+++ b/apps/website/src/pages/blog/index.astro
@@ -0,0 +1,30 @@
+---
+/// <reference types="../../env.d.ts" />
+import Layout from '../../layouts/Layout.astro';
+import FormattedDate from '../../components/base/FormattedDate.astro'
+import { getCollection } from 'astro:content';
+
+const posts = (await getCollection('blog')).sort(
+ (a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf()
+);
+---
+
+<Layout title='Polyfrost Blog' description='Recieve Polyfrost updates here'>
+ <section>
+ <ul>
+ {
+ posts.map(post => (
+ <li>
+ <a href={`blog/${post.slug}/`}>
+ <img width={720} height={360} src={post.data.heroImage} alt="" />
+ <h4 class="title">{post.data.title}</h4>
+ <p class="date">
+ <FormattedDate date={post.data.pubDate} />
+ </p>
+ </a>
+ </li>
+ ))
+ }
+ </ul>
+ </section>
+</Layout>