Clean RSS URI + custom template

I learned from this thread that I can remove the .xml suffix from feed URLs:

I have set my configuration as follows:

    suffix: ""
    delimiter: ""
    mediatype: "application/customrss"
    baseName: "feed"

which nicely gives me the /feed URL, but ignores all of my .xml templates (perhaps because suffix is blank) and seems to render the default one instead. I have tried the following without success:

  • baseof.xml
  • baseof.rss.xml
  • baseof.rss.
  • baseof.RSS.
  • baseof.

I’m not sure which lookup path would work here and would appreciate any hints.

Now that I understand what delimiter means (the dot before the suffix), I removed the .xml part and left just the .rss part so that the templates are named like baseof.rss. Works great :+1:t4:. Not sure who wants index.xml as the permalink these days, perhaps feed or rss should be the default.

A template lookup path has nothing to do with the ending of the resulting output. That is one of the common misunderstandings. The lookup path is only how GoHugo finds a layout file for your content.

You define the extension with the media type of your output format suffix. You define the part before that with the basename of the output format where you use your custom media type. If you did not define the basename then the name of the content is used. You wouldn’t be too unnerved by having index.html used as the output file name for your content, so having defined nothing GoHugo will fall back to the index part…

You can find the default file extensions of default media types here - if you want another suffix, create your own media type.

So slight hangup with my solution is that it ‘downloads’ instead of displaying in the browser. One feed reader wasn’t able to recognize it for this reason… I think this happens because the generated file is just called feed with no extension? How might I ensure it behaves like the default feed generated by Hugo?

Sure, actually I don’t mind if it’s called feed.xml but I just prefer clear URLs in in the browser where possible. If you have an idea for how I would have done it differently please let me know.