Skip to content

Commit

Permalink
add cover image to rss
Browse files Browse the repository at this point in the history
  • Loading branch information
vindex10 committed Dec 29, 2023
1 parent a1cb044 commit 19d495b
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions layouts/_default/rss.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
{{- $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" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
<title>{{ if eq .Title site.Title }}{{ site.Title }}{{ else }}{{ with .Title }}{{ . }} on {{ end }}{{ site.Title }}{{ end }}</title>
<link>{{ .Permalink }}</link>
Expand Down Expand Up @@ -73,8 +73,17 @@
{{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }}
<guid>{{ .Permalink }}</guid>
<description>{{ with .Description | html }}{{ . }}{{ else }}{{ .Summary | html }}{{ end -}}</description>
{{- if site.Params.ShowFullTextinRSS }}
<content:encoded>{{ (printf "<![CDATA[%s]]>" .Content) | safeHTML }}</content:encoded>
{{- $isCoverHidden := .Params.cover.hidden | default site.Params.cover.hiddenInSingle | default site.Params.cover.hidden }}
{{- $cover := (partial "cover.html" (dict "cxt" . "IsSingle" false "IsHome" false "isHidden" $isCoverHidden)) -}}
{{- if (or $cover site.Params.ShowFullTextinRSS) -}}
<content:encoded>
{{- if $cover -}}
{{ (printf "<![CDATA[%s]]>" $cover) | safeHTML }}
{{- end -}}
{{- if site.Params.ShowFullTextinRSS }}
{{ (printf "<![CDATA[%s]]>" .Content) | safeHTML }}
{{- end -}}
</content:encoded>
{{- end }}
</item>
{{- end }}
Expand Down

0 comments on commit 19d495b

Please sign in to comment.