# Clean RSS URI + custom template

**URL:** <https://discourse.gohugo.io/t/clean-rss-uri-custom-template/49189>\
**Category:** support\
**Created:** [April 5, 2024, 9:32pm UTC](https://discourse.gohugo.io/t/clean-rss-uri-custom-template/49189 "2024-04-05T21:32:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rosano](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rosano/32/21788_2.png) [@rosano](https://discourse.gohugo.io/u/rosano)\
**Post date:** [April 5, 2024, 9:32pm UTC](https://discourse.gohugo.io/t/clean-rss-uri-custom-template/49189/1 "2024-04-05T21:32:14Z")

</div>

I learned from [this thread](https://discourse.gohugo.io/t/solved-eliminate-xml-suffix-custom-rss-uri/7532) that I can remove the `.xml` suffix from feed URLs:

> [@\[SOLVED\] Eliminate xml suffix | Custom RSS URI](https://discourse.gohugo.io/t/solved-eliminate-xml-suffix-custom-rss-uri/7532/2):
>
> For future reference. What you can do is:
> 
> ```auto
> [mediaTypes]
> [mediaTypes."application/customrss"]
> suffix = ""
> delimiter = ""
> 
> [outputFormats]
> [outputFormats.RSS]
> mediatype = "application/customrss"
> baseName = "rss"
> 
> ```

I have set my configuration as follows:

```yaml
mediaTypes:
  application/customrss:
    suffix: ""
    delimiter: ""
outputFormats:
  RSS:
    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.

---

<div class="post-metadata">

**Author:** ![rosano](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rosano/32/21788_2.png) [@rosano](https://discourse.gohugo.io/u/rosano)\
**Post date:** [April 5, 2024, 9:48pm UTC](https://discourse.gohugo.io/t/clean-rss-uri-custom-template/49189/2 "2024-04-05T21:48:50Z")

</div>

Now that I understand what `delimiter` means ([the dot before the suffix](https://github.com/gohugoio/hugo/blob/02d5ec14f3fea20fa05aa2f0c2b9698620633edc/media/mediaType.go#L44)), I removed the `.xml` part and left just the `.rss` part so that the templates are named like `baseof.rss`. Works great 👍🏽. Not sure who wants `index.xml` as the permalink these days, perhaps `feed` or `rss` should be the default.

---

<div class="post-metadata">

**Author:** ![davidsneighbour](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/davidsneighbour/32/24507_2.png) [@davidsneighbour](https://discourse.gohugo.io/u/davidsneighbour)\
**Post date:** [April 7, 2024, 1:34pm UTC](https://discourse.gohugo.io/t/clean-rss-uri-custom-template/49189/3 "2024-04-07T13:34:34Z")

</div>

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](https://gohugo.io/templates/output-formats/#media-types) - if you want another suffix, create your own media type.

---

<div class="post-metadata">

**Author:** ![rosano](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rosano/32/21788_2.png) [@rosano](https://discourse.gohugo.io/u/rosano)\
**Post date:** [April 8, 2024, 6:46pm UTC](https://discourse.gohugo.io/t/clean-rss-uri-custom-template/49189/4 "2024-04-08T18:46:59Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![rosano](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/rosano/32/21788_2.png) [@rosano](https://discourse.gohugo.io/u/rosano)\
**Post date:** [April 8, 2024, 6:48pm UTC](https://discourse.gohugo.io/t/clean-rss-uri-custom-template/49189/5 "2024-04-08T18:48:15Z")

</div>

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.
