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 -}}
|
||||
{{ $length := (len $list) -}}
|
||||
{{- $pctx := . -}}
|
||||
{{- 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",
|
||||
"title" : "{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{ . }} {{ i18n "string_on" }} {{ end }}{{ .Site.Title }}{{ end }}",
|
||||
|
|
@ -22,7 +28,7 @@
|
|||
},
|
||||
{{ end -}}
|
||||
"items" : [
|
||||
{{ range $index, $element := $list -}}
|
||||
{{ range $index, $element := $pages -}}
|
||||
{
|
||||
"title" : {{ .Title | jsonify }},
|
||||
"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">
|
||||
<channel>
|
||||
<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" -}}
|
||||
{{ printf "<atom:link href=%q rel=\"self\" type=%q />" .Permalink .MediaType | safeHTML }}
|
||||
{{ end -}}
|
||||
{{ range .Pages }}
|
||||
{{ range $pages }}
|
||||
<item>
|
||||
<title>{{ .Title }}</title>
|
||||
<link>{{ .Permalink }}</link>
|
||||
|
|
|
|||
Loading…
Reference in a new issue