Skip to content

Commit 47d1b94

Browse files
feat: add sort to debug page, get the newest first
1 parent 978b6b8 commit 47d1b94

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/pages/events/[id]/dynamic-images/debug.astro

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { getEventsCollection } from "@/lib/events";
33
import { getEventStaticPaths } from "./_utils";
44
import MainLayout from "@/layouts/MainLayout.astro";
5+
import dayjs from "dayjs";
56
67
export const getStaticPaths = () =>
78
import.meta.env.DEV ? getEventStaticPaths() : [];
@@ -19,7 +20,9 @@ const fileNames = files.map((path) => {
1920
2021
const props = Astro.props;
2122
22-
const allEvents = await getEventsCollection();
23+
const allEvents = (await getEventsCollection()).sort((a, b) =>
24+
dayjs(b.data.date).diff(a.data.date),
25+
);
2326
---
2427

2528
<MainLayout>

0 commit comments

Comments
 (0)