Skip to content

Commit da5ce00

Browse files
committed
Remove unpublished ideas from rss feed
1 parent 63c3e8c commit da5ce00

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/pages/rss.xml.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,14 @@ export async function GET(context) {
2121
site: context.site,
2222
// Array of `<item>`s in output xml
2323
// See "Generating items" section for examples using content collections and glob imports
24-
items: ideas.map(idea => ({
25-
title : idea.data.title,
26-
pubDate : idea.data.pubDate,
27-
description: idea.data.description,
28-
link: `/idea/${slug(idea)}`,
29-
})),
24+
items: ideas
25+
.filter(idea => idea.data.pubDate)
26+
.map(idea => ({
27+
title : idea.data.title,
28+
pubDate : idea.data.pubDate,
29+
description: idea.data.description,
30+
link: `/idea/${slug(idea)}`,
31+
})),
3032

3133
trailingSlash: false,
3234
// (optional) inject custom xml

0 commit comments

Comments
 (0)