16 lines
481 B
Plaintext
16 lines
481 B
Plaintext
---
|
|
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 pageTitle={entry.data.title}>
|
|
<Post {entry} {prevSlug} />
|
|
</BaseLayout>
|