all-posts page, page titles, index page
This commit is contained in:
@@ -5,7 +5,8 @@ import Post from '@components/Post.astro';
|
||||
|
||||
export async function getStaticPaths() {
|
||||
const entries = await getCollection('posts');
|
||||
entries.sort((a, b) => a.data.date.getTime() - b.data.date.getTime())
|
||||
// unlike `/index` and `/posts`, we want to sort ascending by date here
|
||||
entries.sort((a, b) => a.data.date.getTime() - b.data.date.getTime());
|
||||
|
||||
// for each route, the page gets passed the entry itself, plus the previous and next slugs
|
||||
// (if any), so that it can render links to them
|
||||
@@ -20,8 +21,9 @@ export async function getStaticPaths() {
|
||||
|
||||
}
|
||||
|
||||
const { entry, prevSlug, nextSlug } = Astro.props;
|
||||
---
|
||||
|
||||
<BaseLayout>
|
||||
<Post {...Astro.props} />
|
||||
<BaseLayout pageTitle={entry.data.title}>
|
||||
<Post {entry} {prevSlug} {nextSlug} />
|
||||
</BaseLayout>
|
||||
|
||||
Reference in New Issue
Block a user