diff options
| author | Andrew Lee <alee14498@protonmail.com> | 2024-02-02 23:25:31 -0500 |
|---|---|---|
| committer | Andrew Lee <alee14498@protonmail.com> | 2024-02-02 23:30:29 -0500 |
| commit | c7264e3ace8a6b1e22420702f00296a4bdadb6da (patch) | |
| tree | 1a157a968bea7e24fc708a22e933e8ea7ce01f1f /src/pages/index.astro | |
| parent | 2c2bdccd645cafd26318c2f2659242f046b61daf (diff) | |
| download | personal-website-c7264e3ace8a6b1e22420702f00296a4bdadb6da.tar.gz personal-website-c7264e3ace8a6b1e22420702f00296a4bdadb6da.tar.bz2 personal-website-c7264e3ace8a6b1e22420702f00296a4bdadb6da.zip | |
Tags; More changes on blog
Diffstat (limited to 'src/pages/index.astro')
| -rw-r--r-- | src/pages/index.astro | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/pages/index.astro b/src/pages/index.astro index 0918a74..35ed847 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -2,8 +2,13 @@ import Layout from '../layouts/Default.astro'; import { Icon } from 'astro-icon/components' import { Image } from 'astro:assets'; +import { getCollection } from "astro:content"; + import Profile from '../images/Alee.png'; import '../styles/index.css'; +import {formatDate} from "../util"; +const allBlogPosts = (await getCollection('blog')).sort((a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf()).slice(0, 10); + --- <Layout title="Andrew Lee" description="Andrew Lee Website"> @@ -73,7 +78,13 @@ import '../styles/index.css'; </div> <div class="box latest-posts"> <h1>Latest Posts</h1> - <p>Hello world</p> + {allBlogPosts.map((post) => ( + <article> + <h1 class="blog-title"><a href={`/blog/${post.slug}`}>{post.data.title}</a></h1> + <small>{formatDate(post.data.pubDate)}</small> + <p>{post.data.description}</p> + </article> + ))} </div> </div> </main> |
