Hugo

RSS Feed Stopped Showing Posts

Im running Hugo v 0.58.1/extended. I put in a new post today and noticed that my rss feed stopped showing my posts. All it showed was this. Previously it show my blog posts. Do I need to change some other files ?

update: I just noticed that the link has gone from mysite.com/index.xml to mysite.com/posts/index.xml . The posts show on the latter link now. How do I get it back on the index

<rss version="2.0">
 <channel>
          <title>Blog</title><link>/</link>
         <description>Recent content on Blog</description>
         <generator>Hugo -- gohugo.io</generator>
         <language>en-us</language>    
         <lastBuildDate>Sat, 07 Sep 2019 12:11:05 -0500</lastBuildDate>
         <atom:link href="/index.xml" rel="self"     type="application/rss+xml"/>
         <item>
               <title>Posts</title>
              <link>/posts/</link>
               <pubDate>Sat, 07 Sep 2019     12:11:05 -0500</pubDate>
              <guid>/posts/</guid><description/></item>
   </channel></rss>

Here is my layout, which the standard layout from the hugo docs.

{{ printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>" | safeHTML }}
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <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 "Section" "post" }}
<item>
  <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>
</item>
{{ end }}
</channel>
 </rss>

Share an entire site if you’d like someone to clone it and help you debug. :slight_smile:

here is my repo https://gitlab.com/kashifk/kashifs-blog

I understand there’s been a change to how .Pages works since 0.58. To access all pages, you now need to use .Site.Pages.

So I think you need to change Line 16

To read

    {{ range .Site.Pages }}

Or

    {{ range .Site.RegularPages }}
3 Likes

thank you so much, that was it :slight_smile: