blog/src/pages/index.astro

27 lines
741 B
Text

---
import PostTitleList from '@/components/PostTitleList.astro'
import Layout from '@/layouts/Layout.astro'
import { getPinnedPosts, getPostsByYear } from '@/utils/content'
const pinnedPosts = await getPinnedPosts()
const postsByYear = await getPostsByYear()
---
<Layout>
<main>
<!-- Pinned Posts -->
{pinnedPosts.length > 0 && (
<section class="mb-7.5">
<div class="uno-decorative-line"></div>
<PostTitleList posts={pinnedPosts} />
</section>
)}
<!-- Regular Posts -->
{[...postsByYear.entries()].map(([_year, posts]) => (
<section class="mb-7.5">
<div class="uno-decorative-line"></div>
<PostTitleList posts={posts} />
</section>
))}
</main>
</Layout>