From b83c906262cb5e1f045ac50f2401527c0b64074c Mon Sep 17 00:00:00 2001 From: satnaing Date: Fri, 11 Nov 2022 15:31:20 +0630 Subject: [PATCH] fix: fix broken post links and hide draft posts in rss feed --- src/pages/rss.xml.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/pages/rss.xml.ts b/src/pages/rss.xml.ts index d3879779a..d98a8e984 100644 --- a/src/pages/rss.xml.ts +++ b/src/pages/rss.xml.ts @@ -17,10 +17,12 @@ export const get = () => title: SITE.title, description: SITE.desc, site: SITE.website, - items: posts.map(({ frontmatter }) => ({ - link: slugify(frontmatter), - title: frontmatter.title, - description: frontmatter.description, - pubDate: new Date(frontmatter.datetime), - })), + items: posts + .filter(({ frontmatter }) => !frontmatter.draft) + .map(({ frontmatter }) => ({ + link: `posts/${slugify(frontmatter)}`, + title: frontmatter.title, + description: frontmatter.description, + pubDate: new Date(frontmatter.datetime), + })), });