Page is sticky in RSS Feed

Since multipages use, they always appear at the top of the RSS feed, even when new content is added (this also happens with site.Pages where sections appear before regular pages). Any way to prevent this?

Probably. You will have to show a sample. My guess is, that the frontmatter is doing something that makes it sticky.

Clone the linked example in my first comment, then create a new rss.xml file inside it in layouts/_default with the code below. Now open the /index.xml file and see. Even if you change the date of any other file to a more recent one, the multipage post (post 8) remains at the top.

{{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- $pages := slice -}}
{{- if or $.IsHome $.IsSection -}}
{{- $p1 := $pctx.RegularPages -}}
{{- $p2 := where $pctx.Pages "Layout" "multipage" -}}
{{- $pages = $p1 | union ($p2) -}}
{{- else -}}
{{- $pages = $pctx.Pages -}}
{{- end -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}
{{- end -}}
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
<rss version="2.0" xmlns: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 --</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 }}
    {{- 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 }}<author>{{.}}{{ with $ }} ({{.}}){{end}}</author>{{end}}
      <guid>{{ .Permalink }}</guid>
      <description>{{ .Summary | html }}</description>
    {{ end }}

The content in RSS will show on the top when it’s the latest. See what’s the lastmod or publishDate for them. You you don’t have, than probably it’s taken from system when site is generated.

See my previous comment.

Could you post a link to live rss where issue is shown.

Here (check dates of post 8 and 9).

See here. Is the order correct?
Second, see what year is showing for pages at the booth.

Order is correct in your case, as I also found out with an RSS previewer. The problem is with the service I use to send out my RSS newsletter (Mailerlite) which uses the RSS feed order as it is, with the page at the top. I would guess a service like Mailchimp would also behave the same.

Make sure they got dates set correctly <pubDate> and will more likely work with everything.

My bad! The pages needed to be sorted by date and in reverse
{{- $pages = $pages.ByDate.Reverse }}

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