Add "Woofer Exploration" and improve drafting

This commit is contained in:
Bad Manners 2024-06-23 18:24:59 -03:00
parent a9d5a88d0e
commit 405ad38f5d
25 changed files with 300 additions and 189 deletions

View file

@ -29,11 +29,11 @@ const getLinkForUser = (user: CollectionEntry<"users">, lang: Lang) => {
};
export const GET: APIRoute = async ({ site }) => {
const stories = (await getCollection("stories", (story) => !story.data.isDraft))
.sort((a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime())
const stories = (await getCollection("stories", (story) => !story.data.isDraft && story.data.pubDate))
.sort((a, b) => b.data.pubDate!.getTime() - a.data.pubDate!.getTime())
.slice(0, MAX_ITEMS);
const games = (await getCollection("games", (game) => !game.data.isDraft))
.sort((a, b) => b.data.pubDate.getTime() - a.data.pubDate.getTime())
const games = (await getCollection("games", (game) => !game.data.isDraft && game.data.pubDate))
.sort((a, b) => b.data.pubDate!.getTime() - a.data.pubDate!.getTime())
.slice(0, MAX_ITEMS);
const users = await getCollection("users");
@ -45,7 +45,7 @@ export const GET: APIRoute = async ({ site }) => {
await Promise.all(
stories.map<Promise<FeedItem>>(async ({ data, slug, body }) => ({
title: `New story! "${data.title}"`,
pubDate: toNoonUTCDate(data.pubDate),
pubDate: toNoonUTCDate(data.pubDate!),
link: `/stories/${slug}`,
description:
`${t(data.lang, "story/warnings", data.wordCount, data.contentWarning.trim())} ${data.descriptionPlaintext || data.description}`
@ -81,7 +81,7 @@ export const GET: APIRoute = async ({ site }) => {
await Promise.all(
games.map<Promise<FeedItem>>(async ({ data, slug, body }) => ({
title: `New game! "${data.title}"`,
pubDate: toNoonUTCDate(data.pubDate),
pubDate: toNoonUTCDate(data.pubDate!),
link: `/games/${slug}`,
description:
`${t(data.lang, "game/platforms", data.platforms)}. ${data.contentWarning} ${data.descriptionPlaintext || data.description}`