Fix typo and add latest uploads to index

This commit is contained in:
Bad Manners 2024-03-25 15:35:24 -03:00
parent 41c2f92927
commit 00fa1fb164
7 changed files with 101 additions and 31 deletions

View file

@ -7,9 +7,11 @@ type FeedItem = RSSFeedItem & {
pubDate: Date;
};
const MAX_ITEMS = 10;
export const GET: APIRoute = async ({ site }) => {
const stories = await getCollection("stories", (story) => !story.data.isDraft);
const games = await getCollection("games", (game) => !game.data.isDraft);
const stories = (await getCollection("stories", (story) => !story.data.isDraft)).sort((a, b) => getUnixTime(b.data.pubDate) - getUnixTime(a.data.pubDate)).slice(0, MAX_ITEMS);
const games = (await getCollection("games", (game) => !game.data.isDraft)).sort((a, b) => getUnixTime(b.data.pubDate) - getUnixTime(a.data.pubDate)).slice(0, MAX_ITEMS);
return rss({
title: "Gallery | Bad Manners",
description: "Stories, games, and (possibly) more by Bad Manners",
@ -37,6 +39,6 @@ export const GET: APIRoute = async ({ site }) => {
]
.flat()
.sort((a, b) => getUnixTime(b.pubDate) - getUnixTime(a.pubDate))
.slice(0, 10),
.slice(0, MAX_ITEMS),
});
};