all-posts page, page titles, index page

This commit is contained in:
2026-03-30 05:27:41 -04:00
parent 5ffb51d5ce
commit fd8ed38572
6 changed files with 126 additions and 7 deletions

View File

@@ -1,7 +1,15 @@
---
import { getCollection } from 'astro:content';
import BaseLayout from '@layouts/BaseLayout.astro';
import Post from '@components/Post.astro';
const entries = await getCollection('posts');
entries.sort((a, b) => b.data.date.getTime() - a.data.date.getTime());
// there will always be at leaste one entry
const entry = entries[0]!;
const prevSlug = entries[1] ? entries[1]?.id : null;
---
<BaseLayout>
<p>Index file</p>
<BaseLayout pageTitle={entry.data.title}>
<Post {entry} {prevSlug} />
</BaseLayout>