Skip to content

Commit

Permalink
Adding xmlns:content namespace to RSS feed and only write content:enc…
Browse files Browse the repository at this point in the history
…oded if something on .Content (adityatelange#1411)

* Added xmlns:content namespace for valid RSS feeds with content:encoded

* Only write <content:encoded> in RSS if ShotFullTextinRSS and .Content has something

fixes: adityatelange#1385
  • Loading branch information
DJLink authored and ayedaemon committed Mar 27, 2024
1 parent 3309f08 commit 0d4a2f3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 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,7 +73,7 @@
{{- with $authorEmail }}<author>{{ . }}{{ with $authorName }} ({{ . }}){{ end }}</author>{{ end }}
<guid>{{ .Permalink }}</guid>
<description>{{ with .Description | html }}{{ . }}{{ else }}{{ .Summary | html }}{{ end -}}</description>
{{- if site.Params.ShowFullTextinRSS }}
{{- if and site.Params.ShowFullTextinRSS .Content }}
<content:encoded>{{ (printf "<![CDATA[%s]]>" .Content) | safeHTML }}</content:encoded>
{{- end }}
</item>
Expand Down

0 comments on commit 0d4a2f3

Please sign in to comment.