From eeed2a201b614bba5c5b74566d5a4b41c8bc1cc3 Mon Sep 17 00:00:00 2001 From: KazooTTT Date: Fri, 21 Feb 2025 21:58:26 +0800 Subject: [PATCH] feat: update date sorting function in notes pages --- src/pages/notes/[...page].astro | 4 ++-- src/pages/notes/list/[...page].astro | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pages/notes/[...page].astro b/src/pages/notes/[...page].astro index 4c4c9ff..55f0712 100644 --- a/src/pages/notes/[...page].astro +++ b/src/pages/notes/[...page].astro @@ -3,7 +3,7 @@ import { type CollectionEntry, getCollection } from "astro:content"; import Pagination from "@/components/Paginator.astro"; import Note from "@/components/note/Note.astro"; import PageLayout from "@/layouts/Base.astro"; -import { collectionModifiedDateSort } from "@/utils/date"; +import { collectionDateSort } from "@/utils/date"; import type { GetStaticPaths, Page } from "astro"; import { Icon } from "astro-icon/components"; @@ -11,7 +11,7 @@ export const getStaticPaths = (async ({ paginate }) => { const MAX_NOTES_PER_PAGE = 10; const allNotes = await getCollection("note"); const notesCount = allNotes.length; - return paginate(allNotes.sort(collectionModifiedDateSort), { + return paginate(allNotes.sort(collectionDateSort), { pageSize: MAX_NOTES_PER_PAGE, props: { notesCount }, }); diff --git a/src/pages/notes/list/[...page].astro b/src/pages/notes/list/[...page].astro index e0ebe87..62ad758 100644 --- a/src/pages/notes/list/[...page].astro +++ b/src/pages/notes/list/[...page].astro @@ -3,7 +3,7 @@ import { type CollectionEntry, getCollection } from "astro:content"; import Pagination from "@/components/Paginator.astro"; import Note from "@/components/note/Note.astro"; import PageLayout from "@/layouts/Base.astro"; -import { collectionModifiedDateSort } from "@/utils/date"; +import { collectionDateSort } from "@/utils/date"; import type { GetStaticPaths, Page } from "astro"; import { Icon } from "astro-icon/components"; @@ -11,7 +11,7 @@ export const getStaticPaths = (async ({ paginate }) => { const MAX_NOTES_PER_PAGE = 10; const allNotes = await getCollection("note"); const notesCount = allNotes.length; - return paginate(allNotes.sort(collectionModifiedDateSort), { + return paginate(allNotes.sort(collectionDateSort), { pageSize: MAX_NOTES_PER_PAGE, props: { notesCount }, });