Possible to create custom feed at /feed.xml?

I’m building a site for a podcast that needs an iTunes-friendly feed at [mydomain]/feed.xml. I also want to keep the default feed for our episodes at /episodes/index.xml, which is automatically in place. Ideally, I would create the iTunes feed as a list that happens to use XML formatting, but it doesn’t appear that 1) there’s a way to create two lists (two feeds, in my case) from the same content type or 2) there’s a way to rename this list and move the path to the base of my domain.

Am I missing something here, or will I just need to create my feed.xml file manually and put it in static?

If you host the site yourself you can just add a redirect. For example I use nginx and have the following in my site config:

location ~ ^/(?:feed|rss)\.xml$ {
    return 301 https://cowboyprogrammer.org/index.xml;

Yeah I can redirect but was trying to avoid that. Oh well.

Any particular reason it needs to be feed.xml, and not index.xml at the root, but with the episodes? I have done the same with the theme for my podcast, where index.xml contains itunes-friendly tags, but only for pages of type episode.

You can take a look at the code here…it’s kind of sloppy, but it works.

I am doing the same thing with a theme I’m developing…I haven’t added the root feed yet, but the idea of having the iTunes-friendly feed live at episode/index.xml has been completed. The code for that is here

In the castanet theme I’m developing, the feed at the root (/index.xml) will have both posts and episodes, with the episodes made iTunes-friendly, although the idea is that the podcast subscribe link should be the one at /episode/index.xml so that podcatchers/iTunes don’t consume blog posts, etc.

I’d love your thoughts and feedback. I also love seeing a podcaster using Hugo instead of WordPress, which is part of why i’m developing Castanet :slightly_smiling:

Well my podcast has already been up and running for several years, so I’m trying my best not to change the location/filename of anything. I know I could use .htaccess, but trying to avoid that as well.

What I ended up doing was just using the auto-generated base-level feed file, changing its name to “feed.xml” in my config, and then filtering it to only allow episodes and no other content types. Then for those who want to subscribe to the actual episode content pieces on the website, I’ll just use episode/feed.xml.

Edit: Oh yeah, agreed totally on WP. I’m currently using WP because originally I just wanted something I could get up and running quickly, but I really don’t like WP and for a site as simple as what I have for our podcast, it’s really overkill when I can use an alternative solution (Hugo) that doesn’t require a database.

Changing the URL of your feed isn’t the end of the world either…you can just shove in the tag itunes:new-feed-url with the new location, but the old one still has to work too, for a while…

I had .htaccess challenges when we first started using hugo for our show, since we hosted on GH Pages…but when we moved to Netlify, we can do redirects now, so they don’t pain me as much as they used to :slightly_smiling:

Our show lived on WP for the first year or so, and then we moved to Hugo, because my co-hosts hated having to log into WP to do show notes, etc…it’s so much more rad to be able to do it all via git. We even occasionally have gotten PR’s from listeners with fixes/updates to our show notes :slightly_smiling:

Since I’ve got you and you have experience with this, I just came across a weird issue that I wonder if you’ve encountered.

In my rss.xml template (its location, as noted, is configured to feed.xml, but for the template you still have to use rss.xml), I’m building each episode <item> for the itunes feed based on metadata in the front matter of each post. But since I want only episodes and not any other kind of post, I have it filtered with {{ if eq .Type "episode"}}

Wrapping outside of that if, I have a range filter because I couldn’t figure out a proper way to keep it from taking only the most recent 15 or so episodes. So, before the above code, I have {{ range first 1000 .Data.Pages }}. At first I thought that fixed the problem, but now that I’ve finished adding in all content, my build is only adding the most recent 47 <item>s to the file. No idea why that seems to be the cutoff. Any thoughts on how to address this?

Hmm. That’s odd. My construct seems quite similar to yours.

But the output file DOES include 71 (which is all) of the episodes.

[Edit] Oh! I know why, because you’re using the built-in feed generator, which I don’t think you can override for size (which is why I ended up going to the template among other reasons)

Oooh, I didn’t know you could use range that way. I copied your syntax for the iteration and it works perfectly now. Thank you!

By the way, I think your theme is simple and to the point. I personally don’t care for the color scheme, but it works, and that’s, again, just a personal preference. There’s plenty of stuff that it would work for.

Yeah, the color scheme is going to be something that can be configured on a user basis (I haven’t added that feature yet) - for now, I was just coming up with the starter. I also have a bit of layout stuff to fix on the responsiveness. If you look at the issues log you can see I’ve got a bunch to do still :slight_smile:

I did a little bit more in the new theme I’m creating…

and then later, since I want only episodes AFTER the first one for the rows…

1 Like

I like it.