From 31277ef18fe64020b8c9d94098008e51a9169210 Mon Sep 17 00:00:00 2001 From: shakilurrehman21 Date: Sun, 8 Nov 2026 18:40:05 +0530 Subject: [PATCH] Fix cross-platform path handling in RSS feed generator --- src/utils/rss.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/utils/rss.js b/src/utils/rss.js index 82764351c1c..5ec09257252 100644 --- a/src/utils/rss.js +++ b/src/utils/rss.js @@ -19,10 +19,11 @@ const getAllFiles = function (dirPath, arrayOfFiles) { arrayOfFiles = arrayOfFiles || []; files.forEach(function (file) { - if (fs.statSync(dirPath + '/' + file).isDirectory()) { - arrayOfFiles = getAllFiles(dirPath + '/' + file, arrayOfFiles); + const fullPath = path.join(dirPath, file); + if (fs.statSync(fullPath).isDirectory()) { + arrayOfFiles = getAllFiles(fullPath, arrayOfFiles); } else { - arrayOfFiles.push(path.join(dirPath, '/', file)); + arrayOfFiles.push(fullPath); } }); @@ -51,7 +52,8 @@ exports.generateRssFeed = function () { if (id !== 'index.md') { const content = fs.readFileSync(filePath, 'utf-8'); const {data} = matter(content); - const slug = filePath.split('/').slice(-4).join('/').replace('.md', ''); + const relativePath = path.relative(dirPath, filePath).replace(/\\/g, '/'); + const slug = relativePath.replace(/\.md$/, ''); if (data.title == null || data.title.trim() === '') { throw new Error(