Skip to content

Commit

Permalink
chore(rss): use the extended tag content:encoded for content
Browse files Browse the repository at this point in the history
  • Loading branch information
razonyang committed Sep 8, 2022
1 parent f2e20f0 commit 4583d25
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion exampleSite/config/_default/params.toml
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,4 @@ viewer = true # Image Viewer
# expand = true # Expand docs navigations.

[feeds]
# contentAsDescription = true
content = true
13 changes: 5 additions & 8 deletions layouts/partials/rss.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,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 All @@ -34,13 +34,10 @@
<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}}
<guid>{{ .Permalink }}</guid>
<description>
{{- if default false $.Site.Params.feeds.contentAsDescription }}
{{- printf "<![CDATA[%s]]>" .Content | safeHTML }}
{{- else }}
{{- printf "<![CDATA[%s]]>" .Summary | safeHTML }}
{{- end }}
</description>
<description>{{- printf "<![CDATA[%s]]>" .Summary | safeHTML }}</description>
{{- if default false $.Site.Params.feeds.content }}
<content:encoded>{{- printf "<![CDATA[%s]]>" .Content | safeHTML }}</content:encoded>
{{- end }}
{{- partial "rss/enclosure" . }}
</item>
{{ end }}
Expand Down

0 comments on commit 4583d25

Please sign in to comment.