3

We've got a Sitecore headless project using NextJS. I've setup an rss feed using the OOTB Sitecore RSS functionality and it seems to be generating the correct xml when I view it through EE or preview.

The issue we have is that our front end is a JSS application using NextJs. If I navigate to the rss url using the front end it just renders a blank page. My initial thought was a rewrite to the backend url in the NextJS application but that returns a not found 302 error.

Is there a simple way (something built in to JSS?) to have the rss feeds be visible from the front end in a JSS NextJS application?

3
  • Generally speaking, sitemap generation should be helpful in figuring this out: sitecore.stackexchange.com/search?q=sitemap+nextjs. Please confirm if you are using SXA? Commented Nov 8, 2023 at 23:32
  • Please also confirm if you are using SSG. Commented Nov 8, 2023 at 23:40
  • Thanks, I'll look into sitemap, should have thought of that. We aren't using SXA and are using SSG for all pages by default, but do have some other routes on SSR. Commented Nov 8, 2023 at 23:46

2 Answers 2

1

The OOTB RSS feed functionality is MVC only. It is not supported in headless JSS. If you want an RSS feed, you need to implement the functionality yourself in the head application.

0

There is a simple way: given some URL path to an existing MVC RSS feed, the idea would be for your head to fetch the RSS response from Sitecore behind the scenes and return that as the response.

There are numerous approaches:

  1. If you have a reverse proxy in front of Sitecore and your head application, you can route requests (from your middleware) to specific paths directly to Sitecore.
  2. Use the NextJS API as wrapper to fetch the content of the RSS endpoint.
  3. You can also look into adding a page under /pages or modifying the [[...path]].ts slug file.

Otherwise, RSS implies a sitemap of sorts, so check out the NextJS documentation on Sitemaps and seek out existing RSS feed repositories for React based heads.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.