diff options
author | Wyvest <wyvestbusiness@gmail.com> | 2024-01-20 11:29:57 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-20 11:29:57 -0500 |
commit | 0afab2cd1b1266034d35cd66f41c3bde90847f9e (patch) | |
tree | 54172a78823cf76761ab88e21d6d2c64d5b965c3 /apps/website/src/pages/blog | |
parent | 55b593c4e6b90137995aee9a55ba2a86423cc7bd (diff) | |
parent | 55548a94b61ce7d1ca0ca8da69db7566f937cfeb (diff) | |
download | Nexus-0afab2cd1b1266034d35cd66f41c3bde90847f9e.tar.gz Nexus-0afab2cd1b1266034d35cd66f41c3bde90847f9e.tar.bz2 Nexus-0afab2cd1b1266034d35cd66f41c3bde90847f9e.zip |
Merge pull request #4 from Polyfrost/website/icon-fix
Diffstat (limited to 'apps/website/src/pages/blog')
-rw-r--r-- | apps/website/src/pages/blog/[...slug].astro | 23 | ||||
-rw-r--r-- | apps/website/src/pages/blog/index.astro | 30 |
2 files changed, 53 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..abdde0a --- /dev/null +++ b/apps/website/src/pages/blog/[...slug].astro @@ -0,0 +1,23 @@ +--- +// 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..4bccad4 --- /dev/null +++ b/apps/website/src/pages/blog/index.astro @@ -0,0 +1,30 @@ +--- +/// <reference types="../../env.d.ts" /> +import { getCollection } from 'astro:content'; +import FormattedDate from '../../components/base/FormattedDate.astro'; +import Layout from '../../layouts/Layout.astro'; + +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> |