diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/components/Header.astro | 2 | ||||
-rw-r--r-- | src/pages/blog/index.astro | 17 |
2 files changed, 18 insertions, 1 deletions
diff --git a/src/components/Header.astro b/src/components/Header.astro index b371be6..4571a5c 100644 --- a/src/components/Header.astro +++ b/src/components/Header.astro @@ -18,5 +18,5 @@ <header> <a href="/">Home</a> - <a href="/blog">Blog</a> + <a href="/blog/">Blog</a> </header> diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro new file mode 100644 index 0000000..210a7a1 --- /dev/null +++ b/src/pages/blog/index.astro @@ -0,0 +1,17 @@ +--- +import { getCollection } from "astro:content"; +import Layout from "../../layouts/BaseLayout.astro"; +import PostSummary from "../../components/PostSummary.astro"; + +const posts = await getCollection("blog", ({ data }) => { + return data.draft !== true; +}); + +posts.sort((a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime()); +--- + +<Layout> + <section style={{ "margin-top": "3rem" }}> + {posts.map((post) => <PostSummary post={post} />)} + </section> +</Layout> |