Skip to content

Commit

Permalink
follow hugo's rss logic
Browse files Browse the repository at this point in the history
  • Loading branch information
shaform committed Jul 17, 2020
1 parent e04e3e7 commit 34aadcf
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions layouts/rss.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{{- $pctx := . -}}
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
{{- $pages := $pctx.RegularPages -}}
{{- $pages := slice -}}
{{- if or $.IsHome $.IsSection -}}
{{- $pages = $pctx.RegularPages -}}
{{- else -}}
{{- $pages = $pctx.Pages -}}
{{- end -}}
{{- $limit := .Site.Config.Services.RSS.Limit -}}
{{- if ge $limit 1 -}}
{{- $pages = $pages | first $limit -}}
Expand All @@ -21,7 +26,7 @@
<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 }}
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
{{ end }}
{{ range $pages }}
<item>
Expand Down

0 comments on commit 34aadcf

Please sign in to comment.