diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2024-01-25 22:36:09 -0500 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2024-01-25 22:39:03 -0500 |
| commit | 875d33f1d98083bf9ba897238db6ecf19efe03c1 (patch) | |
| tree | 68dc0d7cd519982e1d0b7a2d478e8d11ddc3a6da /src/pages | |
| parent | 3bfe8125606c7829fbbbb2906ab622c3b3600865 (diff) | |
| download | personal-website-875d33f1d98083bf9ba897238db6ecf19efe03c1.tar.gz personal-website-875d33f1d98083bf9ba897238db6ecf19efe03c1.tar.bz2 personal-website-875d33f1d98083bf9ba897238db6ecf19efe03c1.zip | |
Giving blog style
Diffstat (limited to 'src/pages')
| -rw-r--r-- | src/pages/blog/index.astro | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro index 1ebc9e9..94687fa 100644 --- a/src/pages/blog/index.astro +++ b/src/pages/blog/index.astro @@ -1,19 +1,35 @@ --- import Page from "../../layouts/Page.astro"; import { getCollection } from "astro:content"; +import {formatDate} from "../../util"; -const allBlogPosts = await getCollection('blog'); +const allBlogPosts = (await getCollection('blog')).sort((a, b) => b.data.date.valueOf() - a.data.date.valueOf()); --- <Page title="Blog" description="Where I post can be anything!"> <main> {allBlogPosts.map((post) => ( <article> - <h2>{post.data.title}</h2> - <sm>{post.data.date}</sm> + <h2><a href={`/blog/${post.slug}`}>{post.data.title}</a></h2> + <small>{formatDate(post.data.date)}</small> <p>{post.data.description}</p> <a href={`/blog/${post.slug}`}>Read more</a> </article> - )) + )) + } </main> </Page> +<style> + h2 { + margin-top: 2px; + margin-bottom: 2px; + } + + article { + background-color: #3B513B; + padding: 1.2em; + border-radius: 20px; + gap: 0.5em; + margin: 0.5em; + } +</style> |
