Skip to content

Commit cea142e

Browse files
authored
Merge pull request #273 from boxdox/rss-fix
Fix RSS missing content on feed readers
2 parents 8519a84 + 7754325 commit cea142e

2 files changed

Lines changed: 54 additions & 1 deletion

File tree

content/this-month/2022-10/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ on Twitter.
161161

162162
At the first ever EuroRust conference from 13th to 14th October, Colin Finck gave a talk about the challenges of developing his [`nt-list`](https://github.com/ColinFinck/nt-list) crate.
163163
The crate provides a safe and idiomatic Rust wrapper around the Windows variant of Linked Lists.
164-
It was presented on this blog [in July](/this-month/2022-07/#nt-list-windows-linked-lists-in-idiomatic-rust).
164+
It was presented on this blog [in July](../../this-month/2022-07/#nt-list-windows-linked-lists-in-idiomatic-rust).
165165

166166
A [recording](https://www.youtube.com/watch?v=IxhZIyXOIw8) of the talk has just been uploaded.
167167
Check it out, and also check out the [other videos](https://www.youtube.com/channel/UCR3gXcme1HMK7_TrUaNZOqw/videos) from that conference for some great takes on Rust!

templates/rss.xml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<rss xmlns:atom="http://www.w3.org/2005/Atom"
3+
xmlns:content="http://purl.org/rss/1.0/modules/content/"
4+
xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
5+
<channel>
6+
<title>
7+
{{ config.title }}
8+
{%- if term %} - {{ term.name }}
9+
{%- elif section.title %} - {{ section.title }}
10+
{%- endif -%}
11+
</title>
12+
<link>
13+
{%- if section -%}
14+
{{ section.permalink | escape_xml | safe }}
15+
{%- else -%}
16+
{{ config.base_url | escape_xml | safe }}
17+
{%- endif -%}
18+
</link>
19+
<description>{{ config.description }}</description>
20+
<generator>Zola</generator>
21+
<language>{{ lang }}</language>
22+
<atom:link href="{{ feed_url | safe }}" rel="self" type="application/rss+xml"/>
23+
24+
{% if last_updated is defined %}
25+
<lastBuildDate>{{ last_updated | date(format="%a, %d %b %Y %H:%M:%S %z") }}</lastBuildDate>
26+
{% endif %}
27+
28+
{%- for page in pages %}
29+
<item>
30+
<title>{{ page.title | escape_xml }}</title>
31+
<pubDate>{{ page.date | date(format="%a, %d %b %Y %H:%M:%S %z") }}</pubDate>
32+
<link>{{ page.permalink | escape_xml | safe }}</link>
33+
<guid isPermaLink="true">{{ page.permalink | escape_xml | safe }}</guid>
34+
<description xml:base="{{ page.permalink | escape_xml | safe }}">
35+
<![CDATA[{{ page.summary | default(value=page.title) }}]]>
36+
</description>
37+
<content:encoded>
38+
{#
39+
first replace transforms internal links to permalink.
40+
second one replaces relative link to parent path. it only does 1 level.
41+
#}
42+
{% set base = page.components | slice(end=-1) | join(sep='/') %}
43+
<![CDATA[{{
44+
page.content
45+
| replace(from='href="#', to='href="' ~ page.permalink ~ '#')
46+
| replace(from='href="../', to='href="' ~ config.base_url ~ '/' ~ base ~ '/')
47+
| safe
48+
}}]]>
49+
</content:encoded>
50+
</item>
51+
{%- endfor %}
52+
</channel>
53+
</rss>

0 commit comments

Comments
 (0)