Wix has built-in posting of the blog-feed.xml file. I would like to post other xml files like this as RSS feeds for collection content additions that occur regularly.
I looked at creating a page without headers and footers and only an “text” element, but the editor changes formatting even though it is just a “text” element.
Is there a way to post content like /blog-feed.xml to the website in the same format (and .xml file extension), so that I could have /rss1.xml and /rss2.xml (and so forth) that I would use code to update whenever the associated collection has new content added?
It should be. It makes no sense that Wix only made RSS button for the Blog. It should be option for customize, so we can use it for both Blog and Dynamic Pages connected to collections. If we want more functionality we can code around it.
You could install the “pixl-xml” extension and then call XML.parse on the xml object. This converts the body to JSON that can be used to render to different text elements
Thank you for your comments identifying a tool to generate xml and work with xml. The basic issue, however, is the ability to post an xml file to a Wix website root, in the same way that the Wix blog-feed.xml file is posted. This does not seem to be possible with the Wix editor.
Thanks, @amotor . But I think there is a misunderstanding. My original post was not about consuming an RSS feed into a Wix data collection (which your suggestions address). It is about publishing an RSS feed on the Wix site that is fed from a local Wix collection.
I know this is an old thread, but for anyone still looking for an answer—the solution is to expose an API endpoint which returns an XML file in response to a GET request. To do this:
Create a backend file called http-functions.js
Adapt the following code to return the RSS feed:
import { ok } from "wix-http-functions";
export function get_rssFeed(request) {
const rssFeed = `<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>Sample Podcast</title>
<link>https://www.example.com</link>
<description>A sample RSS feed for a podcast</description>
<language>en-us</language>
<item>
<title>Episode 1 - Introduction</title>
<link>https://www.example.com/episode1</link>
<description>This is the first episode of our sample podcast.</description>
<pubDate>${new Date().toUTCString()}</pubDate>
<guid>1</guid>
</item>
</channel>
</rss>`;
let options = {
headers: {
"Content-Type": "application/xml"
},
body: rssFeed
};
return ok(options);
}