Skip to main content

Displaying the Full Content in Hugo's RSS feed

·481 words·3 mins
Hong Konger.

Background #

Recently I created a hugo blog and started writing articles (yes, that’s the blog you are reading). Later, I found that can publish articles (as draft) from a RSS feed. In that way I don’t have to copy-and-paste my articles manually in order to publish the same item on!

😨 Problem #

Although’s puslishing from RSS feed service is great, my Hugo site is not that great (with the basic settings). When I was trying to sync my RSS feed items to, all items can be imported but only the beginning part of the content was fetched.

I know that should be something wrong with the RSS feeds generated by Hugo. The default Hugo RSS template only renders Summary of an article and my Hugo theme is using that:

As you can see in line 73, the <description> in my RSS feeds contain article summary only but not the full content. Is there any ways to change the Summary here into something else? Something else that represents the full content?

😀 Solution #

Locating rss.xml #

Usually, Hugo templates are placed under {your hugo theme}/layouts/_defualt/. If such file does not exist, it’s time to create one. You can copy-and-paste the code from Hugo’s github or run the following curl command under /layouts/_default to download it:

curl "" > rss.xml

Rendering the full content #

Rendering the full content of is really simple and straight-forward. What you need to do is just replacing this:

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

With this:

<description>{{- .Content | html -}}</description>

Caution: use {{- instead of {{. Read the bonus part if you want to know what is the difference.

Regenerating the site #

Updating the RSS template will not update your generated content automatically. Therefore, you need to re-generate your Hugo site:


You should see the changes in all RSS xml files (from git). After that, push all the code changes, remove all the fetched posts in and re-fetch them. That’s it.

Bonus: The difference between {{ and {{- in Hugo #

You may notice that the template code is changed into {{- from {{. As a newbie in Hugo I checked the Hugo’s official documentation about whitespace.

… the ability to trim the whitespace from either side of a Go tag …

This - notation is introduced in Go 1.6.

The following example (from the documentation):

  {{ .Title }}
  {{- .Title -}}

Which will output:

  Hello, World!
<div>Hello, World!</div>

In other words, that’s the trim() in JavaScript. That’s the String.Trim() in C#.

Conclusion #

The default RSS feed in Hugo site shows article abstract only. By defining a custom rss.xml template and replacing {{ .Summary | html }} with {{- .Content | html -}} in the <description> tag you will get the article’s full content in the re-generated RSS xml files.


How to add a new Hugo blog post
·43 words·1 min
Go to blog folder
Documentation Makes Easy With MkDocs and GitLab Pages
·1045 words·5 mins
A guide to build a static website using MkDocs and deploy it to GitLab Pages.
A Tale of Two Caches: Redis and the cache helper
·884 words·5 mins
A note on how to add Redis and the cache helper to a .NET core Mvc app.