# \[SOLVED\] Eliminate xml suffix | Custom RSS URI

**URL:** <https://discourse.gohugo.io/t/solved-eliminate-xml-suffix-custom-rss-uri/7532>\
**Category:** support\
**Created:** [July 21, 2017, 1:11pm UTC](https://discourse.gohugo.io/t/solved-eliminate-xml-suffix-custom-rss-uri/7532 "2017-07-21T13:11:08Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [July 21, 2017, 1:11pm UTC](https://discourse.gohugo.io/t/solved-eliminate-xml-suffix-custom-rss-uri/7532/1 "2017-07-21T13:11:08Z")

</div>

Is there a way to hide the xml suffix from a Hugo feed?

My current Tumblr feed is found at [http://onedrawingperday.com/rss](http://onedrawingperday.com/rss)

I have already configured my new Hugo site feed like this:

> ```
> [outputs]
> home = ["HTML", "RSS"]
> 
> ```

> ```
> [outputFormats]
> [outputFormats.RSS]
> mediatype = "application/rss"
> baseName = "rss"
> 
> ```

However the feed is available under: `/rss.xml` and ideally I would like to have it under `/rss` so that my subscribers get the new feed automatically without having to inform them

I’ve tried the following without success:  
`suffix=""` resolves to `/rss.xml` with the template under `/layouts/index.rss.xml`

`suffix="rss"` resolves as above even with the template as `/layouts/index.rss`

Is this possible?

EDIT  
If not I guess I’ll have to try an XML Level Redirect

EDIT 2  
No help needed. I just found out that Tumblr hides the suffix in the URL. The actual Tumblr feed is located under `/rss.xml` so I don’t think I’ll have a problem with feed readers as I have already named the new feed like the old one.

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [July 21, 2017, 5:31pm UTC](https://discourse.gohugo.io/t/solved-eliminate-xml-suffix-custom-rss-uri/7532/2 "2017-07-21T17:31:10Z")

</div>

> [@alexandros](#):
>
> [outputFormats]  
> [outputFormats.RSS]  
> mediatype = “application/rss”  
> baseName = “rss”

For future reference. What you can do is:

```auto
[mediaTypes]
[mediaTypes."application/customrss"]
suffix = ""
delimiter = ""

[outputFormats]
[outputFormats.RSS]
mediatype = "application/customrss"
baseName = "rss"

```

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [July 21, 2017, 5:36pm UTC](https://discourse.gohugo.io/t/solved-eliminate-xml-suffix-custom-rss-uri/7532/3 "2017-07-21T17:36:27Z")

</div>

Thank you! That is even better!

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [July 22, 2017, 11:25am UTC](https://discourse.gohugo.io/t/solved-eliminate-xml-suffix-custom-rss-uri/7532/4 "2017-07-22T11:25:46Z")

</div>

> [@bep](#):
>
> [mediaTypes]  
> [mediaTypes.“application/customrss”]  
> suffix = “”  
> delimiter = “”
> 
> [outputFormats]  
> [outputFormats.RSS]  
> mediatype = “application/customrss”  
> baseName = “rss”

Like I said yesterday thanks to your input I am able to have the feed without the suffix under `/rss` but unfortunately I cannot find how to use a custom RSS template with this setup.

No matter what I do Hugo always ends up using the internal template.

I’ve tried the following template variations with no success:  
`/layouts/_default/rss.xml`  
`/layouts/_default/index.rss.xml`  
`/layouts/_default/index.rss`  
`/layouts/_default/rss`  
`/layouts/_default/rss.rss`

And also I’ve tried all of the above under just `/layouts/`

The thing is that I really need a custom RSS template. And I am able to render it as needed under `/rss.xml`

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [July 22, 2017, 1:14pm UTC](https://discourse.gohugo.io/t/solved-eliminate-xml-suffix-custom-rss-uri/7532/5 "2017-07-22T13:14:37Z")

</div>

The RSS is a little special in the layouts department (I kept it this way to avoid breaking stuff), so when you redefine that output format you may end up with some surprises.

What I suggest you do is something ala:

```auto
[outputs]
home = ["HTML", "CUSTOMRSS"]

[mediaTypes]
[mediaTypes."application/customrss"]
suffix = ""
delimiter = ""

[outputFormats]
[outputFormats.CUSTOMRSS]
mediatype = "application/customrss"
baseName = "rss"

```

The above should give you less surprises.

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [July 22, 2017, 1:18pm UTC](https://discourse.gohugo.io/t/solved-eliminate-xml-suffix-custom-rss-uri/7532/6 "2017-07-22T13:18:55Z")

</div>

Also see [https://gohugo.io/templates/output-formats/#output-formats-for-pages](https://gohugo.io/templates/output-formats/#output-formats-for-pages)

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [July 22, 2017, 1:58pm UTC](https://discourse.gohugo.io/t/solved-eliminate-xml-suffix-custom-rss-uri/7532/7 "2017-07-22T13:58:55Z")

</div>

Right. I understand. With the above in the site’s `config.toml` I was able to turn off Hugo’s internal RSS template.

But no dice. The feed is not generated now at all. It gives me a 404.

I cannot figure out how to name the template for the CUSTOMRSS Output Format and where to put it.

Again I tried several variations like `customrss` and `customrss.xml` under `/layouts/_default` but I always get a blank page.

Anyway thanks for your help.

I’ve already spent way too much time on this. I’m calling it a day.

---

<div class="post-metadata">

**Author:** ![bep](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/bep/32/3332_2.png) [@bep](https://discourse.gohugo.io/u/bep)\
**Post date:** [July 22, 2017, 2:02pm UTC](https://discourse.gohugo.io/t/solved-eliminate-xml-suffix-custom-rss-uri/7532/8 "2017-07-22T14:02:08Z")

</div>

If you have your site sourceo online, I can look at it.

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [July 22, 2017, 4:51pm UTC](https://discourse.gohugo.io/t/solved-eliminate-xml-suffix-custom-rss-uri/7532/9 "2017-07-22T16:51:57Z")

</div>

Thanks @bep but I just made it!

The solution was in the post of this thread: [How to use the new Custom Output Formats - #5 by tutume](https://discourse.gohugo.io/t/how-to-use-the-new-custom-output-formats/6318/5)

I simply named the template `list.customrss` under `/layouts/_default/` and BINGO! The custom RSS feed was rendered.

In my `config.toml` I used exactly what you posted above.

This info is already in the docs in the table for the different Output Formats example: [Custom output formats | Hugo](https://gohugo.io/templates/output-formats/#link-to-output-formats)

But it wasn’t that clear. I think I’ll send a pull request for the Docs as soon as I have more time to make this plain and simple. To include a phrase like this one:

> The naming of an Output Formats template follows the same pattern that is used for standard Hugo templates. eg. `list.[kind].[suffix]` under `/layouts/_default` or `index.[kind].[suffix]` under `/layouts/`

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [July 22, 2017, 6:10pm UTC](https://discourse.gohugo.io/t/solved-eliminate-xml-suffix-custom-rss-uri/7532/10 "2017-07-22T18:10:04Z")

</div>

A final note just for aesthetic purposes.

That CUSTOMRSS Output Format is a bit of an eyesore.

So in `config.toml` I changed it to XML:

> ```
> [outputs]
> home = ["HTML", "XML"]
> 
> [mediaTypes]
> [mediaTypes."application/xml"]
> suffix = ""
> delimiter = ""
> 
> [outputFormats]
> [outputFormats.XML]
> mediatype = "application/xml"
> baseName = "rss"
> 
> ```

And then the template is simply called `list.xml` under `/layouts/_default`

Mission accomplished. And the custom RSS feed validates at w3c.

One minor issue that I have is that Hugo’s default RSS is rendered as HTML in Firefox with the following encoding declaration appended to it. `<?xml version="1.0" encoding="utf-8" standalone="yes" ?>`

This doesn’t happen with my Custom RSS Output Format. When I view it in the browser (namely Firefox) it is wrapped in `<pre>` tags and displayed as code not HTML. But in Feed Readers the Custom RSS is displayed properly. I’ll live with this. Who reads RSS feeds from the browser in 2017 anyway?

So that’s all there is to it for anyone who needs a custom RSS URI when migrating a site to Hugo.

---

<div class="post-metadata">

**Author:** ![alexandros](https://avatars.discourse-cdn.com/v4/letter/a/ecc23a/32.png) [@alexandros](https://discourse.gohugo.io/u/alexandros)\
**Post date:** [July 22, 2017, 7:30pm UTC](https://discourse.gohugo.io/t/solved-eliminate-xml-suffix-custom-rss-uri/7532/11 "2017-07-22T19:30:24Z")

</div>

No I will not live with the missing xml declaration in my custom RSS feed!

Naturally Go Templates showed its ugly teeth once again.

As soon as I included `<?xml version="1.0" encoding="utf-8" standalone="yes" ?>` in my `list.xml` the first charset “\<” became “&lt ;”, and made the XML unreadable. Exactly as reported over here: [https://stackoverflow.com/questions/32333279/golang-template-escape-first-char](https://stackoverflow.com/questions/32333279/golang-template-escape-first-char)

I was having none of this weirdness, so Hugo Template Functions to the rescue!

Simply made a partial called `declaration.html` its contents are just the `xml` declaration from above.

And then in my `list.xml` I called it like this:  
`{{ partial "declaration" . | htmlUnescape | safeHTML }}`

Now the Custom RSS renders as HTML in Firefox! Identical to Hugo’s default RSS.

(I feel like I’m on my way to becoming a Hugo guru) 🤓
