From 23a267a24225bda7e989858613c92a26e288c881 Mon Sep 17 00:00:00 2001 From: lew Date: Thu, 29 Jan 2026 01:54:43 +0000 Subject: [PATCH] fix: filter draft posts from random, feed, and sitemap --- apps/www/src/pages/feed.xml.ts | 2 +- apps/www/src/pages/random.ts | 2 +- apps/www/src/pages/sitemap.txt.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/www/src/pages/feed.xml.ts b/apps/www/src/pages/feed.xml.ts index 78478ba..6b13096 100644 --- a/apps/www/src/pages/feed.xml.ts +++ b/apps/www/src/pages/feed.xml.ts @@ -19,7 +19,7 @@ interface TxtFile { } export async function GET(context: APIContext) { - const posts = await getCollection('posts'); + const posts = await getCollection('posts', ({ data }) => data.draft !== true); const bookmarks = yaml.load(bookmarksRaw) as Bookmark[]; const txtDir = path.join(process.cwd(), 'public/txt'); diff --git a/apps/www/src/pages/random.ts b/apps/www/src/pages/random.ts index 780fc56..40a11ac 100644 --- a/apps/www/src/pages/random.ts +++ b/apps/www/src/pages/random.ts @@ -15,7 +15,7 @@ interface Bookmark { export async function GET(context: APIContext) { const site = context.site?.origin ?? 'https://wynne.rs'; - const posts = await getCollection('posts'); + const posts = await getCollection('posts', ({ data }) => data.draft !== true); const bookmarks = yaml.load(bookmarksRaw) as Bookmark[]; const txtDir = path.join(process.cwd(), 'public/txt'); diff --git a/apps/www/src/pages/sitemap.txt.ts b/apps/www/src/pages/sitemap.txt.ts index a823f9d..921e6c8 100644 --- a/apps/www/src/pages/sitemap.txt.ts +++ b/apps/www/src/pages/sitemap.txt.ts @@ -9,7 +9,7 @@ const SUBDOMAINS = [ export async function GET(context: APIContext) { const site = context.site?.origin ?? 'https://wynne.rs'; - const posts = await getCollection('posts'); + const posts = await getCollection('posts', ({ data }) => data.draft !== true); const txtDir = path.join(process.cwd(), 'public/txt'); const txtFiles = fs.existsSync(txtDir)