Fix updated logic for all posts page

This commit is contained in:
Cassidy Williams
2023-12-27 01:17:54 -06:00
parent 5a0c3fbfd7
commit 9f0a9a19b4

View File

@@ -10,8 +10,8 @@ import { SITE_TITLE, SITE_DESCRIPTION } from "../config";
// Use Astro.glob() to fetch all posts, and then sort them by date.
const posts = (await Astro.glob("../posts/*.md")).sort(
(a, b) =>
new Date(b.frontmatter.added).valueOf() -
new Date(a.frontmatter.added).valueOf()
new Date(b.frontmatter.updated || b.frontmatter.added).valueOf() -
new Date(a.frontmatter.updated || a.frontmatter.added).valueOf()
);
---