Building a RSS page

Hi.

I’m trying to build a custom RSS link. I would use the WP native one like explained in this ticket: RSS feed but I cannot use it because my site is in WordPress.com and when you switch domains, the RSS link is also redirected so I’d like to create a new library to generate the RSS.

The problem is that I cannot find a way to generate XML whenever a user lands on /feed because Frontity, if I’m not wrong, doesn’t have any slot before the tag, which would be very handy (though not sure if even possible) to overwrite the whole document. I cannot find either some sort of middleware to hook before the request is done and use a different template than the one in Frontity core (frontity/packages/core/src/server/templates/html.ts).

Is there a current way to do something like this?

Thanks!

Hey @igmoweb, welcome to the community. I’m really happy to have you here :smile: :clap:

So, the main problem is that if you use the original RSS feed of WordPress.com the links of that feed will point to the xxx.wordpress.com domain, right?

Hey @luisherranz. Yeah, I cannot link to the wordpress.com RSS feed because the domain redirects to igmoweb.com. At first, I thought to leave igmoweb.wordpress.com as it is and block search engines so they don’t index it but the RSS feed it would link to igmoweb.wordpress, and I don’t want visitors to land there.

So, for WP.com, I think that the only solution would be to generate a custom RSS feed. I can do it myself but for that, I need to generate xml pages in Frontity and I cannot find a way as I cannot replace the whole tag in Frontity. Having a way to replace the main template that Frontity uses to render the HTML and the main root would be very handy for these cases. I think I could come up then with a RSS generator package for Frontity. Unless there’s a way for that :slight_smile:

Hey, this is exciting :slightly_smiling_face:

I guess there would be two ways to do this:

  1. Use React to generate the XML.
  2. Use a Node library to generate the XML.

Both require server extensibility, which is coming soon because next on the list is AMP support and we need it for that.

Even though I love using React to render different things (option 1), there is already an excellent Node library to generate feeds (option 2):

If you are using Vercel (Now), you don’t need to wait for server extensibility, you can make this work today adding a Serverless function to their project. Inside that Serverless function, you can use the feed package and return the RSS feed. Add pagination and so on.

There is about how to use Vercel’s Serverless functions and Frontity together in this topic: Using now serveless functions with frontity

Then, once we have server extensibility, we can move that code to a Frontity server package and publish it so it works just by installing the package and on any hosting service :slightly_smiling_face:

What do you think?

1 Like

Nice! I didn’t know about the existence of those Serverless Functions so for now that’s what I’ll create.Looking forward to see that server extensibility!

1 Like

Hi, I have created an rss page on /feed on my page using the option 2 (using axios and feed) from above. I have created a gist with the files I used to create the serverless function on vercel: https://gist.github.com/pichichi91/60d3becbc39b83b9e2c64c4626fc9522

Maybe this helps someone

2 Likes

Thanks for sharing that! :slight_smile:

1 Like