From d77cf7a9cf538dc208b1a3eebccdadcdefb60d56 Mon Sep 17 00:00:00 2001 From: Vishvamsinh Vaghela Date: Fri, 1 Nov 2024 15:57:44 +0530 Subject: [PATCH] fewgge --- scripts/build-rss.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/build-rss.js b/scripts/build-rss.js index 444580c344a0..17bb4380d2ab 100644 --- a/scripts/build-rss.js +++ b/scripts/build-rss.js @@ -55,13 +55,15 @@ module.exports = async function rssFeed(type, title, desc, outputPath) { rss.channel.generator = 'next.js' rss.channel.item = [] + const invalidPosts = posts.filter(post => + !post.title || !post.slug || !post.excerpt || !post.date + ); + + if (invalidPosts.length > 0) { + throw new Error('Missing required fields in post data'); + } + for (let post of posts) { - const invalidPosts = posts.filter(post => - !post.title || !post.slug || !post.excerpt || !post.date - ); - if (invalidPosts.length > 0) { - throw new Error('Missing required fields in post data'); - } const link = `${base}${post.slug}${tracking}`; const { title, excerpt, date } = post; const pubDate = new Date(date).toUTCString();