Skip to content

Commit 73cf5a7

Browse files
committed
Fix feed rendering
1 parent e470f07 commit 73cf5a7

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

templates/feed.xml

+8-6
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,20 @@
1818
{% for page in section.pages | reverse %}
1919
<entry>
2020
<title>{{ macros::escape_hbs(input=page.title) | safe }}</title>
21-
<link rel="alternate" href="https://blog.rust-lang.org{{ section.path | trim_end_matches(pat="/") }}{{ macros::escape_hbs(input=page.path) | safe }}" type="text/html" title="{{ macros::escape_hbs(input=page.title) | safe }}" />
22-
{%- set year = page.components[0] | int %}
23-
{%- set month = page.components[1] | int %}
24-
{%- set day = page.components[2] | int %}
21+
<link rel="alternate" href="https://blog.rust-lang.org{{ macros::escape_hbs(input=page.path) | safe }}" type="text/html" title="{{ macros::escape_hbs(input=page.title) | safe }}" />
22+
{%- set num_comps = page.components | length %}
23+
{%- set year = page.components | nth(n=num_comps - 4) %}
24+
{%- set month = page.components | nth(n=num_comps - 3) %}
25+
{%- set day = page.components | nth(n=num_comps - 2) %}
2526
<published>{{ year }}-{{ month }}-{{ day }}T00:00:00+00:00</published>
2627
<updated>{{ year }}-{{ month }}-{{ day }}T00:00:00+00:00</updated>
27-
<id>https://blog.rust-lang.org{{ section.path | trim_end_matches(pat="/") }}{{ macros::escape_hbs(input=page.path) | safe }}</id>
28-
<content type="html" xml:base="https://blog.rust-lang.org{{ section.path | trim_end_matches(pat="/") }}{{ macros::escape_hbs(input=page.path) | safe }}">{{ macros::escape_hbs(input=page.content) }}</content>
28+
<id>https://blog.rust-lang.org{{ macros::escape_hbs(input=page.path) | safe }}</id>
29+
<content type="html" xml:base="https://blog.rust-lang.org{{ macros::escape_hbs(input=page.path) | safe }}">{{ macros::escape_hbs(input=page.content) }}</content>
2930

3031
<author>
3132
<name>{{ macros::escape_hbs(input=page.authors | join(sep=", ")) }}</name>
3233
</author>
3334
</entry>
35+
{%- if loop.index == 10 %}{% break %}{% endif %}
3436
{%- endfor %}
3537
</feed>

0 commit comments

Comments
 (0)