1
0
Fork 0
mirror of https://github.com/safing/web synced 2025-04-17 09:29:08 +00:00

Bring our RSS feed to a workable state

Correctly utilize <content:encoded> and <description> tags according to:

https://stackoverflow.com/a/54905457
https://www.rssboard.org/rss-profile#namespace-elements-content-encoded

If there is a summary, show it in <description> with the content being in <content:encoded>. If there is NO summary, put the content in <description>.

Also, I added a custom "summary"/disclaimer for progress update blogs to clarify that the HTML of update blogs really is not compatible with readers but should be viewed in the Webview.
This commit is contained in:
davegson 2021-05-26 15:00:42 +02:00
parent a449c88bb6
commit f2f2eeb7c2

View file

@ -2,7 +2,7 @@
layout: null
---
<?xml version="1.0" encoding="UTF-8"?>
<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:dc="http://purl.org/dc/elements/1.1/" xmlns:content="'http://purl.org/rss/1.0/modules/content/">
<channel>
<title>{{ site.title | xml_escape }}</title>
<description>{{ site.description | xml_escape }}</description>
@ -15,13 +15,26 @@ layout: null
{% for post in sorted_blogs %}
<item>
<title>{{ post.title | xml_escape }}</title>
<description>{{ post.content | xml_escape }}</description>
{% if post.progress_update %}
<description>Progress Updates Are Only Compatible in Webview (due to CSS tricks for NoJS support)</description>
<content:encoded>
{{ post.content | markdownify | xml_escape }}
</content:encoded>
{% elsif post.summary %}
<description>{{ post.summary | markdownify | xml_escape }}</description>
<content:encoded>
{{ post.content | markdownify | xml_escape }}
</content:encoded>
{% else %}
<description>{{ post.content | xml_escape }}</description>
{% endif %}
<pubDate>{{ post.date | date_to_rfc822 }}</pubDate>
<link>{{ site.url }}{{ site.base_url }}{{ post.url | replace_first: '/', '' }}</link>
<guid isPermaLink="true">{{ site.url }}{{ site.base_url }}{{ post.url | replace_first: '/', '' }}</guid>
{% for tag in post.tags %}
<category>{{ tag | xml_escape }}</category>
{% endfor %}
<dc:creator>{{ post.author | xml_escape }}</dc:creator>
</item>
{% endfor %}
</channel>