Skip to content

Commit 674b974

Browse files
committed
fix(blog): Fix homepage link in RSS feed
When following the Node.js Blog at https://nodejs.org/en/blog in a feed reader like NetNewsWire, the homepage link gets broken. Instead of navigating the browser to the website, one gets a blank page and an unexpected RSS feed download in the background. The `<link>` tag in RSS 2.0 is for the HTML website. Note that the "self" link from the RSS file back to itself is separate form this and already auto-generated by the Feed class. [1] While at it, fix the broken `<description>undefined</defined>` element. This is often left empty and fine not to pass in `/apps/site/site.json`. However, the upstream Feed class has a bug where it takes the undefined and outputs the string "undefined" as the blog's description instead of a sensible default like empty string. [1]: https://github.com/jpmonette/feed Signed-off-by: Timo Tijhof <krinkle@fastmail.com>
1 parent f7e9126 commit 674b974

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

apps/site/next-data/generators/__tests__/websiteFeeds.test.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ describe('generateWebsiteFeeds', () => {
3030
id: siteConfig.rssFeeds[0].file,
3131
title: siteConfig.rssFeeds[0].title,
3232
language: 'en',
33-
link: `${base}/feed/${siteConfig.rssFeeds[0].file}`,
34-
description: siteConfig.rssFeeds[0].description,
33+
link: base,
34+
description: siteConfig.rssFeeds[0].description || '',
3535
});
3636

3737
const date = new Date(blogData.posts[0].date);

apps/site/next-data/generators/websiteFeeds.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ const generateWebsiteFeeds = ({ posts }) => {
3232
id: file,
3333
title: title,
3434
language: 'en',
35-
link: `${canonicalUrl}/feed/${file}`,
36-
description: description,
35+
link: canonicalUrl,
36+
description: description || '',
3737
});
3838

3939
const blogFeedEntries = posts

0 commit comments

Comments
 (0)