diff options
author | Valentin Popov <valentin@popov.link> | 2024-09-13 00:02:35 +0300 |
---|---|---|
committer | Valentin Popov <valentin@popov.link> | 2024-09-13 00:02:35 +0300 |
commit | 3591bebabff902106632f0f0b309f3baa1e04a17 (patch) | |
tree | 4d87d68d3812782a5349cfa821c5e83fedd44fa1 /src/pages/index.astro | |
parent | 4ac7da1231b07049d76a1d3e33d4b00f2536629c (diff) | |
download | popov.link-3591bebabff902106632f0f0b309f3baa1e04a17.tar.xz popov.link-3591bebabff902106632f0f0b309f3baa1e04a17.zip |
Sort blog posts by publication date
Diffstat (limited to 'src/pages/index.astro')
-rw-r--r-- | src/pages/index.astro | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/pages/index.astro b/src/pages/index.astro index 6df8f31..6575ca6 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -4,6 +4,7 @@ import Element from "../components/PostElement.astro"; import Layout from "../layouts/BaseLayout.astro"; const posts = await getCollection("blog"); +posts.sort((a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime()); --- <Layout> |