Skip to content

Commit

Permalink
Better sort posts
Browse files Browse the repository at this point in the history
  • Loading branch information
morr0ne committed May 20, 2024
1 parent 47120db commit feabd39
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/pages/posts/index.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import FormattedDate from '@components/FormattedDate.astro';
import Base from '@layouts/Base.astro';
const posts = (await getCollection('blog')).sort(
(a, b) => a.data.pubDate.valueOf() - b.data.pubDate.valueOf(),
(a, b) => b.data.pubDate.valueOf() - a.data.pubDate.valueOf(),
);
---

<Base title={SITE_TITLE} description={SITE_DESCRIPTION}>
<section>
<h1>Posts</h1>
<ul>
{
posts.map((post) => (
Expand Down

0 comments on commit feabd39

Please sign in to comment.