Skip to content

Commit

Permalink
feat: block to extend feeds
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudLigny committed Aug 21, 2023
1 parent 3a2f5e2 commit 4b0bd9d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions resources/layouts/_default/list.atom.twig
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
</author>
{%- for p in pages|sort_by_date ~%}
<entry xml:lang="{{ lang }}">
{%- block entry ~%}
<id>{{ url(p, {canonical: true}) }}</id>
<title>{{ p.title|e }}</title>
{%- if 'txt' in p.output|default('html') ~%}
Expand All @@ -33,6 +34,7 @@
<link href="{{ url(p, {canonical: true}) }}" rel="alternate" type="text/html" />
<published>{{ p.date|date('c') }}</published>
<updated>{{ p.updated|date('c') }}</updated>
{%- endblock ~%}
</entry>
{%- endfor ~%}
</feed>
Expand Down
2 changes: 2 additions & 0 deletions resources/layouts/_default/list.jsonfeed.twig
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"items": [
{%- for item in pages|sort_by_date ~%}
{
{%- block item ~%}
"id": {{ url(item, {canonical: true})|json_encode(constant('JSON_UNESCAPED_SLASHES')) }},
"url": "{{ url(item, {canonical: true}) }}",
"title": {{ item.title|json_encode(constant('JSON_UNESCAPED_UNICODE')) }},
Expand All @@ -56,6 +57,7 @@
],
{%- endif ~%}
"language": "{{ item.language|default(site.language|default('en')) }}"
{%- endblock ~%}
}
{%- if not loop.last %},{% endif -%}
{%- endfor ~%}
Expand Down
2 changes: 2 additions & 0 deletions resources/layouts/_default/list.rss.twig
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
<link href="{{ url(page, {canonical: true, format: 'html'}) }}" rel="alternate" type="text/html" />
{%- for p in pages|sort_by_date ~%}
<item>
{%- block item ~%}
<guid>{{ url(p, {canonical: true}) }}</guid>
<title>{{ p.title|e }}</title>
<description><![CDATA[{{ p.content }}]]></description>
<pubDate>{{ p.date|date('c') }}</pubDate>
<link href="{{ url(p, {canonical: true}) }}" rel="alternate" type="text/html" />
{%- endblock ~%}
</item>
{%- endfor ~%}
</channel>
Expand Down

0 comments on commit 4b0bd9d

Please sign in to comment.