# Issue with RSS Feed Generation in Hugo v0.111.2 and v0.138.0

**URL:** https://discourse.gohugo.io/t/issue-with-rss-feed-generation-in-hugo-v0-111-2-and-v0-138-0/52883
**Category:** support
**Created:** [December 25, 2024, 11:01am UTC](https://discourse.gohugo.io/t/issue-with-rss-feed-generation-in-hugo-v0-111-2-and-v0-138-0/52883 "2024-12-25T11:01:21Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![rengarajan01](https://avatars.discourse-cdn.com/v4/letter/r/5fc32e/32.png) [@rengarajan01](https://discourse.gohugo.io/u/rengarajan01)
#### Post date: [December 25, 2024, 11:01am UTC](https://discourse.gohugo.io/t/issue-with-rss-feed-generation-in-hugo-v0-111-2-and-v0-138-0/52883/1 "2024-12-25T11:01:21Z")

</div>

Hi, I am using Hugo v0.111.2 in my production environment and v0.138.0 in my development environment. I’m facing an issue with RSS feed generation: the RSS feed XML files generated by the two versions are different.

The feed generated with v0.138.0 seems fine, and when I validate it using [W3C Feed Validation Service, for Atom and RSS](https://validator.w3.org/feed/), it says the RSS feed is valid. However, the feed generated with v0.111.2 is marked as invalid.

Currently, I cannot upgrade Hugo in my production environment due to various constraints. Were there any major changes related to RSS feed generation in versions after v0.111.2? If so, could someone please explain what changed?

If these changes are significant, please let me know if upgrading to a newer version would be worthwhile.

---

<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: [December 25, 2024, 1:13pm UTC](https://discourse.gohugo.io/t/issue-with-rss-feed-generation-in-hugo-v0-111-2-and-v0-138-0/52883/2 "2024-12-25T13:13:36Z")

</div>

Idea: post your actual generated feed with the valid and invalid code so we have an idea what the actual issue is. Or the RSS layout file if you have one. I understand you have an issue, but I do not know what the issue is. And asking for changes to Hugo between versions is more or less unhelpful, but…

Blackbox idea: Something changed with the way **SUMMARIES** are built. It might be that your feed is showing a summary, so it might have some encoding the validator doesn’t like.

A completely different idea is why your production environment is so much lower. Can’t you update?

You can at least downgrade your local Hugo. You might download a binary from the release page and then run `./hugo` instead of `hugo` using a local binary that is version bound. This will give you at least identical results. 26 versions is a lifetime in regards to hugo versions, and you might miss much more issues.

A very last full-blown solution would be to run `hugo` locally, commit the `public` directory, and then release that directory, instead of running `hugo` on your server.

---

<div class="post-metadata">

### Author: ![rengarajan01](https://avatars.discourse-cdn.com/v4/letter/r/5fc32e/32.png) [@rengarajan01](https://discourse.gohugo.io/u/rengarajan01)
#### Post date: [December 26, 2024, 3:57am UTC](https://discourse.gohugo.io/t/issue-with-rss-feed-generation-in-hugo-v0-111-2-and-v0-138-0/52883/3 "2024-12-26T03:57:40Z")

</div>

> [@davidsneighbour](#):
>
> A very last full-blown solution would be to run `hugo` locally, commit the `public` directory, and then release that directory, instead of running `hugo` on your server.

Hi @davidsneighbour,

Thanks for the reply!

Here are the details:

in v0.111.2, I get rss feed like the following:

```auto
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
    <channel>
        <title>Title of my blog</title>
        <link>https://linktomyblob.com/en/</link>
        <description>This blog is about my personal journey</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en</language>
        <atom:link href="https://linktomyblob.com/en/" rel="self" type="application/rss+xml" />
        <item>
            <title>Introduction</title>
            <link>https://linktomyblob.com/en/introduction/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://linktomyblob.com/en/introduction/myself</guid>
            <description>I&rsquo;m a developer, and I&rsquo;m planning to contribute more to open-source projects. I&rsquo;m also watching out for more such opportunities.</description>
        </item>
    </channel>
</rss>

```

When I paste the above-generated RSS feed into [W3C Feed Validator](https://validator.w3.org/feed/) for validation, I get the following error:

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/gohugo/original/3X/1/2/12b8620c1ec5342e7d824259718f76ad818fc7f6.png)

In v0.138.0, I get the rss feed like the following:

```auto
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>Title of my blog</title>
        <link>https://linktomyblob.com/en/</link>
        <description>This blog is about my personal journey</description>
        <generator>Hugo -- gohugo.io</generator>
        <language>en</language>
        <atom:link href="https://linktomyblob.com/en/" rel="self" type="application/rss+xml" />
        <item>
            <title>Introduction</title>
            <link>https://linktomyblob.com/en/introduction/</link>
            <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
            <guid>https://linktomyblob.com/en/introduction/myself</guid>
            <description>&lt;h1 id=&#34;myself&#34;&gt;About Myself&lt;/h1&gt;&#xA;&lt;h3 id=&#34;introduction&#34;&gt;Introduction&lt;/h3&gt;&#xA;&lt;p&gt;I’m a developer, and I’m planning to contribute more to open-source projects.&lt;/p&gt;&#xA;&lt;p&gt; I’m also watching out for more such opportunities.&lt;/p&gt;</description>
        </item>
    </channel>
</rss>

```

When I paste the above-generated RSS feed into [W3C Feed Validator](https://validator.w3.org/feed/) for validation, I get the following result:

## Congratulations!

This is a valid RSS feed.

(unable to upload the image directly as new users can only put one embedded media item in a post.)

Regarding the Hugo version, the frontmatter content is being written by multiple people. If I have to upgrade the version in the production environment, I need solid reasons to justify the upgrade. While I don’t mind downgrading the Hugo version in my local environment, I want to understand why the RSS feed generated by v0.111.2 differs from v0.138.0.

---

<div class="post-metadata">

### Author: ![irkode](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/irkode/32/26135_2.png) [@irkode](https://discourse.gohugo.io/u/irkode)
#### Post date: [December 26, 2024, 2:12pm UTC](https://discourse.gohugo.io/t/issue-with-rss-feed-generation-in-hugo-v0-111-2-and-v0-138-0/52883/4 "2024-12-26T14:12:03Z")

</div>

Guess @davidsneighbour is right with his guess regarding summary.

If you use the embedded RSS template there’s been an issue with escaping

I found an issue with HTML escaping solved with **v0.121.0**

> [@Problem with RSS - XMLEscape](https://discourse.gohugo.io/t/problem-with-rss-xmlescape/47682):
>
> Hi. I’m running Hugo v0.120.4. I am trying to edit the rss.xml file to deploy full content in my rss feed. The first step I took was to create the rss.xml file in my \_default folder and copy over the built-in RSS template from the zip/github. But when I deploy Hugo with that unedited rss.xml file, I’m getting the following errors (with the same choke point on line 67): ERROR render of "section" failed: Error: error building site: render: failed to render pages: render of "home" failed: exec…

The RSS templates are different:

[embedded RSS template for v0.111.2](https://github.com/gohugoio/hugo/blob/v0.111.2/tpl/tplimpl/embedded/templates/_default/rss.xml)

```
  <description>{{ .Summary | html }}</description>

```

[embedded RSS template for v0.121.0](https://github.com/gohugoio/hugo/blob/v0.121.0/tpl/tplimpl/embedded/templates/_default/rss.xml)

```
  <description>{{ .Summary | transform.XMLEscape | safeHTML }}</description>

```

In [release v134.0](https://github.com/gohugoio/hugo/releases/tag/v0.134.0) the behavior of the .Summary changed. (Summary comparision)[[Content summaries | Hugo](https://gohugo.io/content-management/summaries/#comparison)] but – at least regarding summary – nothing has changed in the templates.

[embedded RSS template for v0.138.0](https://github.com/gohugoio/hugo/blob/v0.138.0/tpl/tplimpl/embedded/templates/_default/rss.xml)

```
  <description>{{ .Summary | transform.XMLEscape | safeHTML }}</description>

```

---

<div class="post-metadata">

### Author: ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)
#### Post date: [December 26, 2024, 2:46pm UTC](https://discourse.gohugo.io/t/issue-with-rss-feed-generation-in-hugo-v0-111-2-and-v0-138-0/52883/5 "2024-12-26T14:46:07Z")

</div>

> [@rengarajan01](#):
>
> `<description>I&rsquo;m a developer...</description>`

If that’s really what your raw RSS looked like, you were not using the embedded RSS template. The embedded RSS template for v0.112.2 would have rendered this instead:

```plaintext
<description>I&amp;rsquo;m a developer.</description>

```

So the problem you have with v0.112.2 is caused by a custom RSS template, which you need to share with us if you need additional assistance.

---

<div class="post-metadata">

### Author: ![rengarajan01](https://avatars.discourse-cdn.com/v4/letter/r/5fc32e/32.png) [@rengarajan01](https://discourse.gohugo.io/u/rengarajan01)
#### Post date: [December 30, 2024, 6:08am UTC](https://discourse.gohugo.io/t/issue-with-rss-feed-generation-in-hugo-v0-111-2-and-v0-138-0/52883/6 "2024-12-30T06:08:27Z")

</div>

> [@jmooring](#):
>
> So the problem you have with v0.112.2 is caused by a custom RSS template, which you need to share with us if you need additional assistance.

Hi @jmooring

Here is my custom RSS template:

```auto
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" >
    <channel>
        <title>{{ .Site.Title }}</title>
        <link>{{ .Site.BaseURL }}</link>
        <description>{{ .Site.Params.description | htmlEscape }}</description>
        <atom:link href="{{ .Site.BaseURL }}index.xml" rel="self" type="application/rss+xml" />
        {{ range .Pages }}
            <item>
                <title>{{ .Title | htmlEscape }}</title>
                <link>{{ .Permalink }}</link>
                <description>{{ .Summary | htmlEscape }}</description>
                <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 MST" }}</pubDate>
                <guid>{{ .Permalink }}</guid>
            </item>
        {{ end }}
    </channel>
</rss>

```

---

<div class="post-metadata">

### Author: ![Heracles](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/heracles/32/19379_2.png) [@Heracles](https://discourse.gohugo.io/u/Heracles)
#### Post date: [December 30, 2024, 9:39am UTC](https://discourse.gohugo.io/t/issue-with-rss-feed-generation-in-hugo-v0-111-2-and-v0-138-0/52883/7 "2024-12-30T09:39:17Z")

</div>

Edit: Apologies, I had something different in mind and provided false advice. Please see the following response.

* * *

If you replace all occurrences of `htmlEncode` with `transform.XMLEscape` then it shouldn’t return any validation errors.

In fact `htmlEncode` is certain to cause issues by introducing the & character.

---

<div class="post-metadata">

### Author: ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)
#### Post date: [December 30, 2024, 1:27pm UTC](https://discourse.gohugo.io/t/issue-with-rss-feed-generation-in-hugo-v0-111-2-and-v0-138-0/52883/8 "2024-12-30T13:27:40Z")

</div>

> [@Heracles](#):
>
> htmlEntity

`htmlEntity` isn’t a function. I think you mean [`transform.HTMLEscape`](https://gohugo.io/functions/transform/htmlescape/).

> [@Heracles](#):
>
> In fact [`transform.HTMLEscape`] is certain to cause issues by introducing the `&` character

It doesn’t cause any problems; some form of escaping is required.

The `&` character is permitted in XML when used in an escape sequence.  
For example, you must replace the `>` character with the `&gt;` escape sequence.

Although `transform.HTMLEscape` is sufficient in most cases, there are some special characters that are allowed in HTML documents that are not allowed in XML documents, so you should use [`transform.XMLEscape`](https://gohugo.io/functions/transform/xmlescape/) instead.

> [@rengarajan01](#):
>
> Here is my custom RSS template:

Compare that with Hugo’s [embedded RSS template](https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_default/rss.xml), where we do this:

```xml
<description>{{ .Summary | transform.XMLEscape | safeHTML }}</description>

```

After escaping special characters, we pipe the result through the `safeHTML` function so that Go’s `html/template` package doesn’t escape it again.

Using this construct, in Hugo’s default configuration, this markdown…

```plaintext
I'm a developer.

```

Is rendered to:

```html
&lt;p&gt;I&amp;rsquo;m a developer.&lt;/p&gt;

```

When testing, make sure you are viewing the source. In your browser, if you are visiting `http://localhost:1313/index.xml`, press Ctrl+U to view the actual source.

* * *

Another way to handle this is with a CDATA section:

```xml
<description>{{ printf "<![CDATA[%s]]>" .Summary | safeHTML }}</description>

```

---

<div class="post-metadata">

### Author: ![Heracles](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/heracles/32/19379_2.png) [@Heracles](https://discourse.gohugo.io/u/Heracles)
#### Post date: [December 30, 2024, 8:20pm UTC](https://discourse.gohugo.io/t/issue-with-rss-feed-generation-in-hugo-v0-111-2-and-v0-138-0/52883/9 "2024-12-30T20:20:44Z")

</div>

Thanks for the detailed response @jmooring, I had something different in mind and provided false advice instead…

If I’m not hijacking the thread, does it make sense to `markdownify` the `.Summary`, or is it returned already rendered as HTML?

To make sure there is no HTML (opinionated, some tags are valid within `<description>`) in the output, I have resorted to this sequence of transformations in my custom RSS template, but maybe its extraneous.

```auto
.Summary | markdownify | htmlUnescape | plainify | transform.XMLEscape | safeHTML

```

Given the opportunity, it seems the [embedded template](https://github.com/gohugoio/hugo/blob/master/tpl/tplimpl/embedded/templates/_default/rss.xml) has some English in it: `<description>Recent content …`

Maybe it shouldn’t force any such content to be useful for international users? I could provide a PR if it helps.

---

<div class="post-metadata">

### Author: ![jmooring](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/jmooring/32/4214_2.png) [@jmooring](https://discourse.gohugo.io/u/jmooring)
#### Post date: [December 30, 2024, 10:16pm UTC](https://discourse.gohugo.io/t/issue-with-rss-feed-generation-in-hugo-v0-111-2-and-v0-138-0/52883/10 "2024-12-30T22:16:09Z")

</div>

> [@Heracles](#):
>
> does it make sense to `markdownify` the `.Summary`

No, it does not.  
[https://gohugo.io/content-management/summaries/#comparison](https://gohugo.io/content-management/summaries/#comparison)

> [@Heracles](#):
>
> sequence of transformations

This should be sufficient:

```html
<description>{{ .Summary | plainify | transform.HTMLEscape | safeHTML }}</description>

```

> [@Heracles](#):
>
> useful for international users

Site and theme authors should override the embedded template as needed using translation tables. We are not adding translation lookups to the embedded templates.

---

<div class="post-metadata">

### Author: ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.gohugo.io/system/32/1_2.png) [@system](https://discourse.gohugo.io/u/system)
#### Post date: [March 20, 2025, 7:08am UTC](https://discourse.gohugo.io/t/issue-with-rss-feed-generation-in-hugo-v0-111-2-and-v0-138-0/52883/11 "2025-03-20T07:08:46Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
