Updated feed templates for Hugo v0.58.0.
This commit is contained in:
parent
fa9f59c76a
commit
f0ba6de8b9
2 changed files with 18 additions and 4 deletions
|
|
@ -1,5 +1,11 @@
|
||||||
{{ $list := .Pages -}}
|
{{- $pctx := . -}}
|
||||||
{{ $length := (len $list) -}}
|
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
|
||||||
|
{{- $pages := $pctx.RegularPages -}}
|
||||||
|
{{- $limit := .Site.Config.Services.RSS.Limit -}}
|
||||||
|
{{- if ge $limit 1 -}}
|
||||||
|
{{- $pages = $pages | first $limit -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{ $length := (len $pages) -}}
|
||||||
{
|
{
|
||||||
"version" : "https://jsonfeed.org/version/1",
|
"version" : "https://jsonfeed.org/version/1",
|
||||||
"title" : "{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} {{ i18n "string_on" }} {{ end }}{{ .Site.Title }}{{ end }}",
|
"title" : "{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} {{ i18n "string_on" }} {{ end }}{{ .Site.Title }}{{ end }}",
|
||||||
|
|
@ -22,7 +28,7 @@
|
||||||
},
|
},
|
||||||
{{ end -}}
|
{{ end -}}
|
||||||
"items" : [
|
"items" : [
|
||||||
{{ range $index, $element := $list -}}
|
{{ range $index, $element := $pages -}}
|
||||||
{
|
{
|
||||||
"title" : {{ .Title | jsonify }},
|
"title" : {{ .Title | jsonify }},
|
||||||
"date_published" : "{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}",
|
"date_published" : "{{ .Date.Format "2006-01-02T15:04:05Z07:00" }}",
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,11 @@
|
||||||
|
{{- $pctx := . -}}
|
||||||
|
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
|
||||||
|
{{- $pages := $pctx.RegularPages -}}
|
||||||
|
{{- $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="http://www.w3.org/2005/Atom">
|
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
||||||
<channel>
|
<channel>
|
||||||
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} {{ i18n "string_on" }} {{ end }}{{ .Site.Title }}{{ end }}</title>
|
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} {{ i18n "string_on" }} {{ end }}{{ .Site.Title }}{{ end }}</title>
|
||||||
|
|
@ -22,7 +30,7 @@
|
||||||
{{ with .OutputFormats.Get "RSS" -}}
|
{{ 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 -}}
|
{{ end -}}
|
||||||
{{ range .Pages }}
|
{{ range $pages }}
|
||||||
<item>
|
<item>
|
||||||
<title>{{ .Title }}</title>
|
<title>{{ .Title }}</title>
|
||||||
<link>{{ .Permalink }}</link>
|
<link>{{ .Permalink }}</link>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue