Skip to content

Commit b83c906

Browse files
committed
fix: fix broken post links and hide draft posts in rss feed
1 parent cce7edd commit b83c906

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/pages/rss.xml.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ export const get = () =>
1717
title: SITE.title,
1818
description: SITE.desc,
1919
site: SITE.website,
20-
items: posts.map(({ frontmatter }) => ({
21-
link: slugify(frontmatter),
22-
title: frontmatter.title,
23-
description: frontmatter.description,
24-
pubDate: new Date(frontmatter.datetime),
25-
})),
20+
items: posts
21+
.filter(({ frontmatter }) => !frontmatter.draft)
22+
.map(({ frontmatter }) => ({
23+
link: `posts/${slugify(frontmatter)}`,
24+
title: frontmatter.title,
25+
description: frontmatter.description,
26+
pubDate: new Date(frontmatter.datetime),
27+
})),
2628
});

0 commit comments

Comments
 (0)