fix: sorting key for blog posts (#629)
The posts use a `publishDate` key, not a `date` key, so this wasn't sorting on anything.
This commit is contained in:
parent
2d1998647c
commit
f841d57d2a
1 changed files with 1 additions and 1 deletions
|
@ -14,7 +14,7 @@ let permalink = 'https://example.com/';
|
|||
|
||||
// Data Fetching: List all Markdown posts in the repo.
|
||||
let allPosts = Astro.fetchContent('./posts/*.md');
|
||||
allPosts = allPosts.sort((a, b) => new Date(b.date) - new Date(a.date));
|
||||
allPosts = allPosts.sort((a, b) => new Date(b.publishDate) - new Date(a.publishDate));
|
||||
|
||||
// Full Astro Component Syntax:
|
||||
// https://github.com/snowpackjs/astro/blob/main/docs/core-concepts/astro-components.md
|
||||
|
|
Loading…
Reference in a new issue