Add photo thumbnail, category, series, and tags to RSS items
This commit is contained in:
parent
d8e842604d
commit
cf5d8755ac
1 changed files with 31 additions and 16 deletions
|
@ -1,14 +1,16 @@
|
||||||
{{- $pctx := . -}}
|
{{- $pctx := . -}}
|
||||||
{{- if .IsHome -}}{{ $pctx = .Site }}{{- end -}}
|
{{- if .IsHome -}}
|
||||||
|
{{ $pctx = .Site }}
|
||||||
|
{{- end -}}
|
||||||
{{- $pages := slice -}}
|
{{- $pages := slice -}}
|
||||||
{{- if or $.IsHome $.IsSection -}}
|
{{- if or $.IsHome $.IsSection -}}
|
||||||
{{- $pages = $pctx.RegularPages -}}
|
{{- $pages = $pctx.RegularPages -}}
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
{{- $pages = $pctx.Pages -}}
|
{{- $pages = $pctx.Pages -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- $limit := .Site.Config.Services.RSS.Limit -}}
|
{{- $limit := .Site.Config.Services.RSS.Limit -}}
|
||||||
{{- if ge $limit 1 -}}
|
{{- if ge $limit 1 -}}
|
||||||
{{- $pages = $pages | first $limit -}}
|
{{- $pages = $pages | first $limit -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- printf "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\"?>" | safeHTML }}
|
{{- 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">
|
||||||
|
@ -26,14 +28,27 @@
|
||||||
{{ 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 }}
|
||||||
{{ if ne .Params.rss_ignore true }}
|
{{ if ne .Type "page" }}
|
||||||
<item>
|
<item>
|
||||||
<title>{{ .Title }}</title>
|
<title>{{ .Title }}</title>
|
||||||
<link>{{ .Permalink }}</link>
|
<link>{{ .Permalink }}</link>
|
||||||
<pubDate>{{ .Date.Format "Mon, 02 Jan 2006 15:04:05 -0700" | safeHTML }}</pubDate>
|
<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}}
|
{{ with .Site.Author.email }}<author>{{.}}{{ with $.Site.Author.name }} ({{.}}){{end}}</author>{{end}}
|
||||||
<guid>{{ .Permalink }}</guid>
|
<guid>{{ .Permalink }}</guid>
|
||||||
<description>{{ .Content | html }}</description>
|
<description>
|
||||||
|
{{ if eq .Section "photos" }}
|
||||||
|
{{ $thumbnail := partial "images/photo_thumbnail.html" (dict "Page" . "Width" 1280 "Height" 1280) }}
|
||||||
|
<img src="{{ $thumbnail.Permalink }}">
|
||||||
|
{{ end }}
|
||||||
|
{{ .Content | html }}
|
||||||
|
</description>
|
||||||
|
{{ with index (.GetTerms "series") 0 }}<category domain="{{ `/series` | absURL }}">{{ .Title }}</category>{{ end }}
|
||||||
|
{{ range .GetTerms "categories" }}
|
||||||
|
<category domain="{{ `/categories` | absURL }}">{{ .Title }}</category>
|
||||||
|
{{ end }}
|
||||||
|
{{ range .GetTerms "tags" }}
|
||||||
|
<category domain="{{ `/tags` | absURL }}">{{ .Title }}</category>
|
||||||
|
{{ end }}
|
||||||
</item>
|
</item>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue