Skip to content

fix: RSS button navigate to 404 page if not with en locale #8073

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kylemocode
Copy link

Description

close #8070

RSS feed links on non-English pages redirect to English feeds because RSS feeds only exist in English.
It is more user friendly instead of showing 404 page without any explanation to the user.

Validation

To test this fix:

  1. Start development server: pnpm dev
  2. Navigate to a non-English blog page (e.g.,/ja/blog)
  3. Click the RSS icon in the blog header
  4. Verify it redirects to the English RSS feed (/en/feed/blog.xml or /en/feed/${file}.xml if you are in certain feed type) instead of 404 not found page

Related Issues

Check List

  • I have read the Contributing Guidelines and made commit messages that follow the guideline.
  • I have run pnpm format to ensure the code follows the style guide.
  • I have run pnpm test to check if all tests are passing.
  • I have run pnpm build to check if the website builds without errors.
  • I've covered new added functionality with unit tests if necessary.

@kylemocode kylemocode requested a review from a team as a code owner August 13, 2025 09:34
Copy link

vercel bot commented Aug 13, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
nodejs-org Ready Preview Aug 15, 2025 1:16pm

Copy link
Member

@AugustinMauroy AugustinMauroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix should be applied on link but on generation. Because the feed actually exist on multiple languages but actually the content isn't translated.

https://github.com/nodejs/nodejs.org/tree/main/apps/site/app/%5Blocale%5D/feed/%5Bfeed%5D

@@ -21,6 +21,7 @@ const BlogHeader: FC<BlogHeaderProps> = ({ category }) => {
{t('layouts.blog.title')}
<Link
href={`/feed/${currentFile}`}
{...{ locale: 'en' }} // RSS feeds only exist in English
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{...{ locale: 'en' }} // RSS feeds only exist in English
locale='en' // RSS feeds only exist in English

Copy link
Author

@kylemocode kylemocode Aug 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@avivkeller
I used object spread here to pass locale because our custom Link component’s prop types are based on HTMLAnchorElement and don’t include locale, thus will cause type error. This approach avoids a larger refactor while keeping the behavior consistent with how the locale prop would be passed in a properly typed Next.js Link. It also ensures we don’t introduce unnecessary complexity just to satisfy type checking for a value that is already fixed (en).

截圖 2025-08-15 晚上9 06 08

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather perform the larger change than have a hacky solution.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll fix it in a PR right now

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can also do that change in my day time tomorrow.
I will see if there is an updated one tomorrow, or else I can help the change.
Thanks for the feedback @avivkeller

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #8081

@kylemocode
Copy link
Author

@AugustinMauroy @avivkeller
Thanks for the quick reply. I change the fix on route generation stage instead of navigate to en feed directly.
Now we can see feeds under all locales as prefixes (The content isn't translated, which I believe will be future enhancement)

@AugustinMauroy
Copy link
Member

The content isn't translated, which I believe will be future enhancement

We have added feeds with translated links in case anyone wants to translate the blog posts. At the moment, this is not being done because we are struggling to get a decent translation for the limited amount of content

@kylemocode
Copy link
Author

@AugustinMauroy
I see, thank you for the detailed explanation.
The current fix should provide a basic user experience, allowing users from different regions to still use the RSS feed feature.

Copy link
Member

@AugustinMauroy AugustinMauroy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGMT !

@kylemocode
Copy link
Author

@AugustinMauroy
For the pending CI checks, only maintainers can trigger the action ? Could you help with that ?

@AugustinMauroy AugustinMauroy added the github_actions:pull-request Trigger Pull Request Checks label Aug 13, 2025
@github-actions github-actions bot removed the github_actions:pull-request Trigger Pull Request Checks label Aug 13, 2025
Copy link
Contributor

github-actions bot commented Aug 13, 2025

Lighthouse Results

URL Performance Accessibility Best Practices SEO Report
/en 🟢 97 🟢 100 🟢 100 🟢 100 🔗
/en/about 🟢 100 🟢 97 🟢 100 🟠 88 🔗
/en/about/previous-releases 🟢 99 🟢 93 🟢 100 🟠 89 🔗
/en/download 🟢 96 🟢 100 🟢 100 🟢 100 🔗
/en/blog 🟢 95 🟢 100 🟢 96 🟢 100 🔗

Copy link

codecov bot commented Aug 13, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.76%. Comparing base (2e4a6d2) to head (4949240).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8073      +/-   ##
==========================================
- Coverage   72.80%   72.76%   -0.04%     
==========================================
  Files          96       96              
  Lines        8328     8328              
  Branches      214      215       +1     
==========================================
- Hits         6063     6060       -3     
- Misses       2264     2267       +3     
  Partials        1        1              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kylemocode
Copy link
Author

@AugustinMauroy
Playwright check failed, but I don't think it is relative to the change

@AugustinMauroy
Copy link
Member

@AugustinMauroy Playwright check failed, but I don't think it is relative to the change

Don't worry about that

@kylemocode
Copy link
Author

kylemocode commented Aug 14, 2025

@ovflowd @mikeesto @avivkeller
Get other core team members to review this idea

@avivkeller
Copy link
Member

The fix should be applied on link but on generation. Because the feed actually exist on multiple languages but actually the content isn't translated.

https://github.com/nodejs/nodejs.org/tree/main/apps/site/app/%5Blocale%5D/feed/%5Bfeed%5D

I don't have a huge preference either way, but I'd prefer to, contrary to what Augustin said, not do this in the routing side, but rather on the linking side, since we only need to adjust a broken link, not add several more files to the site.

We only have an English RSS feed, not one for each language.

Opinions, @nodejs/nodejs-website?

@kylemocode
Copy link
Author

kylemocode commented Aug 15, 2025

I think this also depends on whether you plan to support multiple languages for the RSS feed in the future.
If there’s no such plan, then making the change on the link side might be the more straightforward approach.

From a user’s perspective, if we see that the URL for a feed is in the jp locale, for example, but the actual content is in English, some people might think it’s a bug.

However, if there is a plan to support multiple languages for the RSS feed, then making the change on the routing side seems reasonable, as it would prepare for future translation work.

Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was intentional. Blog posts are not translated.

@kylemocode
Copy link
Author

kylemocode commented Aug 15, 2025

@avivkeller @ovflowd @AugustinMauroy
Based on your feedbacks, I rollback the change to the initial solution, which is on the linking side.
Now users from different locales still can see the RSS feed instead of navigating to 404 page without explanation.
Please help to review again.

@kylemocode kylemocode requested a review from ovflowd August 15, 2025 13:34
Copy link
Member

@mikeesto mikeesto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think linking to the English feed here instead of a 404 is an improvement - LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RSS feed button on non-English pages leads to 404 error page
5 participants