feat: update date sorting function in notes pages

This commit is contained in:
KazooTTT
2025-02-21 21:58:26 +08:00
parent 3e4539ddbe
commit eeed2a201b
2 changed files with 4 additions and 4 deletions

View File

@ -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 },
});

View File

@ -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 },
});