Full-text RSS feed

What is the best way to create a full-text RSS feed for a HUGO site?
Is there an option/param for that or do we need to write a new template to include anything extra in there beyond whats generated by default?

I see that there is s starter template here: https://gohugo.io/templates/rss/#the-embedded-rss-xml

You just answered your own question, or at least provided the way to figure it out:

The link you provided displays the default RSS template that Hugo uses. If there are any site parameters checked to choose between .Summary and .Content, set the value of that parameter. Otherwise, you’ll have to adapt the template for your own needs.

Here is what I did —

I created a template in /layouts/rss.xml based off of the one provided in the Hugo docs: https://gohugo.io/templates/rss/#the-embedded-rss-xml

In that template, I added <content:encoded> below the

<description>{{ .Summary | safeHTML }}</description>
<content:encoded>{{ .Content | safeHTML }}</content:encoded>

I also added safeHTML to description (not in the docs)

Now I am trying to get the content to render without getting caught up on a the encoded special chars in posts
trying <content:encoded><![CDATA[{{ .Content | safeHTML }}]]></content:encoded>

1 Like

Saw this after my other reply :slight_smile:


I have the same issue, I would like to show the full text with the RSS feed.

I tried to with the following variants:
{{ .Content | safeHTML }}

{{ .Summary | safeHTML }}


{{- .Content | html -}}

but the content in the feed is not full yet.

Do you have an idea of what else I should modify?

This is the code of the RSS feed:

<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <title>{{ if eq  .Title  .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
    <link>{{ .Permalink }}</link>
    <description>Recent content {{ if ne  .Title  .Site.Title }}{{ with .Title }}in {{.}} {{ end }}{{ end }}on {{ .Site.Title }}</description>
    <generator>Hugo -- gohugo.io</generator>{{ with .Site.LanguageCode }}
    <language>{{.}}</language>{{end}}{{ with .Site.Author.email }}
    <managingEditor>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</managingEditor>{{end}}{{ with .Site.Author.email }}
    <webMaster>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</webMaster>{{end}}{{ with .Site.Copyright }}
    <copyright>{{.}}</copyright>{{end}}{{ if not .Date.IsZero }}
    <lastBuildDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</lastBuildDate>{{ end }}
    {{ with .OutputFormats.Get "RSS" }}
        {{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
    {{ end }}
    {{ range .Pages }}
      <title>{{ .Title }}</title>
      <link>{{ .Permalink }}</link>
      <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
      {{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
      <guid>{{ .Permalink }}</guid>
      <description>{{- .Content | html -}}</description>
    {{ end }}

have you made sure there aren’t actually two files for the rss feed layout?

Last time I was troubleshooting something like this, found a rogue file lingering outside of the themes folder.

I had inside the folder layouts, 2 folders:
posts — with --> rss.xml for all the blog
categories — with --> rss.xml for only blogs about the categories about R.

I left only the second one, but nothing has changed.
Do you know what else I could check?

sorry man, I’m at a loss here. Your code is similar to mine and everything. Best would be to open a new thread and share your source code so we can all take a look.


hugo --debug

You can see what hugo is looking for. Put your file on the right place with the right name.