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:
Jim Nielsen 2021-07-08 09:55:23 -06:00 committed by GitHub
parent 2d1998647c
commit f841d57d2a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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