Add <pubDate> to RSS posts, add RSS subscribe button, minor changes

This commit is contained in:
Monty
2021-09-28 22:17:30 +02:00
parent db03304803
commit 38ccd7c591
4 changed files with 39 additions and 8 deletions

View File

@@ -49,13 +49,16 @@ router.get('/', async (request, response) => {
// RSS feed
router.get('/feed.xml', async (request, response) => {
const pubDate = new Date(postList()[0].postInfo.date).toUTCString();
// Adds the pubDate to the post array
const posts = postList().map((post) => {
post.postInfo.pubDate = new Date(post.postInfo.date).toUTCString();
return post;
});
response.set('Content-Type', 'application/rss+xml');
response.render('blog-rss', {
layout: false,
postList,
pubDate
posts
});
});