all-posts page, page titles, index page
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user