Skip to content

Commit

Permalink
rss article content
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Drewery committed Jun 29, 2023
1 parent 31a758f commit 857ebfd
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions rss/generate-rss.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ const axios = require('axios');
// Read index.json
const index = JSON.parse(fs.readFileSync('content/index.json', 'utf8'));

// Create a feed
const feed = new RSS({
title: 'Adam Drewery\'s Blog',
description: '',
Expand All @@ -17,20 +16,16 @@ const feed = new RSS({
pubDate: new Date().toUTCString(),
});

// Loop over the articles in the index and add them to the feed
for (const articleId in index) {
const article = index[articleId];

const response = axios.get("blog.drewery.uk/raw/" + articleId);

feed.item({
title: article.title,
description: 'You can add a description here',
url: `https://yourwebsite.com/${articleId}`, // URL of the article
date: article.date,

// Add the article content as HTML
content: response.data
description: response.data,
url: `https://blog.drewery.uk/post/${articleId}`,
date: article.date
});
}

Expand Down

0 comments on commit 857ebfd

Please sign in to comment.