RSS feed with individual post images


Hello, I did a search for this topic but wasn’t able to find an answer that worked for me. I’m trying to create a basic RSS template that supports images per blog post (5 images for 5 items in the list). I have a template being found and loaded properly (copied from the Hugo documentation site). My front-matter blog posts are looking for images = ["/img/image.jpg"]

Any help would be very appreciated.


range for front matter parameters is very tricky and you seem to have your imgs in an array.

The order will always be random (Go templates do this)


In the array, I only have 1 image per blog post.

I just want:

image1.jpg   |    blog title 1

image2.jpg   |    blog title 2


In that case I think you can fetch and render these parameters using with


Thanks but I’m having no luck unfortunately. If you have a code snippet that I can try out, that would be super helpful.


Here is my custom RSS template. Obviously you need to customize it to reference the front matter parameters that are used in your project and change the range since you want to render 5 posts.

<rss version="2.0" xmlns:atom="">
    <title>{{ .Site.Title }}</title>
    <link>{{ .Permalink }}</link>
    <description>{{ .Site.Title }}</description>
    <generator>Hugo --</generator>{{ with .Site.LanguageCode }}
    <language>{{.}}</language>{{end}}{{ with }}
    <managingEditor>{{.}}{{ with $ }} ({{.}}){{end}}</managingEditor>{{end}}{{ with }}
    <webMaster>{{.}}{{ with $ }} ({{.}}){{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 }}
    <atom:link href="{{.URL}}" rel="self" type="application/rss+xml" />
    {{ range first 15 (where .Data.Pages "Section" "blog") }}
      <title>{{ .Title }}</title>
      <link>{{ .Permalink }}</link>
      <pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
      {{ with }}<author>{{.}}{{ with $ }} ({{.}}){{end}}</author>{{end}}
      <guid>{{ .Permalink }}</guid>
      <description>{{ .Content }}</description>
    {{ end }}


Thank you! That’s getting me somewhere!