diff --git a/src/components/HomePosts.astro b/src/components/HomePosts.astro index 84a1554..378348e 100644 --- a/src/components/HomePosts.astro +++ b/src/components/HomePosts.astro @@ -3,16 +3,15 @@ import Post from "../components/Post.astro"; const { allPosts } = Astro.props; -// TODO: account for recently updated posts, too +//.sort(() => 0.5 - Math.random()).slice(0, 3); + let posts = allPosts .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() ) .slice(0, 5); - -//.sort(() => 0.5 - Math.random()).slice(0, 3); --- diff --git a/src/layouts/BlogPost.astro b/src/layouts/BlogPost.astro index 0e8711b..f282a76 100644 --- a/src/layouts/BlogPost.astro +++ b/src/layouts/BlogPost.astro @@ -10,7 +10,7 @@ const posts = await Astro.glob("../posts/*.md"); const tags = getTags(posts); const { - content: { title, description, added, updatedDate, heroImage }, + content: { title, description, added, updated, heroImage }, } = Astro.props; --- @@ -25,9 +25,9 @@ const {

{title}

{added && } { - updatedDate && ( + updated && (
- Last updated on + Last updated on
) }