Skip to content

Commit

Permalink
Attempting to fix RSS
Browse files Browse the repository at this point in the history
  • Loading branch information
latenitefilms committed Jun 14, 2023
1 parent 17db347 commit 9f01135
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions .github/scripts/generate-rss.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,23 @@ function entriesAreEqual(entry1, entry2) {
entry1.url === entry2.url;
}

const feedparser = new FeedParser();
const oldFeedItems = [];
const feedparser = require('feedparser-promised');

let oldFeedItems = [];

if (fs.existsSync('docs/rss.xml')) {
feedparser.parse(fs.createReadStream('docs/rss.xml'))
.then(items => {
for (let item of items) {
oldFeedItems.push(item);
}

pubDate = items[0].pubDate || new Date();
lastBuildDate = items[0].date || new Date();
})
.catch(err => console.error(err));
}

const filePath = path.resolve('docs/rss.xml');
const fileContent = fs.readFileSync(filePath).toString();
const newsDir = path.join(__dirname, 'docs/_includes/news');
Expand Down

0 comments on commit 9f01135

Please sign in to comment.