diff options
author | 2021-07-08 09:55:23 -0600 | |
---|---|---|
committer | 2021-07-08 10:55:23 -0500 | |
commit | f841d57d2a072918a4979f3d3b33b980a34479dd (patch) | |
tree | b5c02e6ef8bcc39910615f088ffe41e2f387502a /examples/blog/src/pages/index.astro | |
parent | 2d1998647ca1297fcf111b9709288902ae006f22 (diff) | |
download | astro-f841d57d2a072918a4979f3d3b33b980a34479dd.tar.gz astro-f841d57d2a072918a4979f3d3b33b980a34479dd.tar.zst astro-f841d57d2a072918a4979f3d3b33b980a34479dd.zip |
fix: sorting key for blog posts (#629)
The posts use a `publishDate` key, not a `date` key, so this wasn't sorting on anything.
Diffstat (limited to 'examples/blog/src/pages/index.astro')
-rw-r--r-- | examples/blog/src/pages/index.astro | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/blog/src/pages/index.astro b/examples/blog/src/pages/index.astro index 2f0cdb01c..13b28d9db 100644 --- a/examples/blog/src/pages/index.astro +++ b/examples/blog/src/pages/index.astro @@ -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 |