mirror of
https://github.com/maciejpedzich/cats-album.git
synced 2024-11-27 22:35:47 +01:00
Order cats by dateAdded descendingly
This commit is contained in:
parent
9449d528f2
commit
1b98aabe37
@ -11,9 +11,9 @@ export interface Props {
|
|||||||
|
|
||||||
export async function getStaticPaths() {
|
export async function getStaticPaths() {
|
||||||
const NUM_CATS_PER_PAGE = 18;
|
const NUM_CATS_PER_PAGE = 18;
|
||||||
|
const allCats = (await getCollection('cats')).sort(
|
||||||
const [firstCat] = await getCollection('cats');
|
(a, b) => b.data.dateAdded.valueOf() - a.data.dateAdded.valueOf()
|
||||||
const allCats = Array(100).fill(firstCat);
|
);
|
||||||
|
|
||||||
const maxPageNum = Math.ceil(allCats.length / NUM_CATS_PER_PAGE);
|
const maxPageNum = Math.ceil(allCats.length / NUM_CATS_PER_PAGE);
|
||||||
const pageNums = [...Array(maxPageNum).keys()].map((key) => key + 1);
|
const pageNums = [...Array(maxPageNum).keys()].map((key) => key + 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user