site/templates/rss.xml
2020-08-11 16:54:14 +02:00

57 lines
3.3 KiB
XML

{%- import "macros.html" as macros -%}
{%- set format = config.extra.formats | filter(attribute="ext", value=term.name | default(value="opus")) | first -%}
{%- set episodes_meta = load_data(path="static/episodes.json") -%}
<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:psc="http://podlove.org/simple-chapters" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0">
<channel>
<title>{{ config.title }}</title>
<link>{{ config.base_url | escape_xml | safe }}</link>
<description>{{ config.description }}</description>
<language>{{ config.default_language }}</language>
<lastBuildDate>{{ last_updated | date(format="%a, %d %b %Y %H:%M:%S %z") }}</lastBuildDate>
{%- if taxonomy -%}
{% for format in config.extra.formats %}
<atom:link rel="{% if format.ext == term.name %}self{% else %}alternate{% endif %}" type="application/rss+xml" title="{{ config.title }} ({{ format.name }})" href="{{ get_url(path="formats/" ~ format.ext ~ "/rss.xml") | escape_xml | safe }}"/>
{%- endfor %}
{%- endif %}
<image>
<url>{{ get_url(path="assets/poster.jpg") | escape_xml | safe }}</url>
<title>{{ config.title }}</title>
<link>{{ config.base_url | escape_xml | safe }}</link>
</image>
<itunes:author>{{ config.extra.author }}</itunes:author>
<itunes:summary>{{ config.description }}</itunes:summary>
<itunes:category text="{{ config.extra.itunes.category }}"/>
<itunes:image href="{{ get_url(path="assets/poster.jpg") | safe }}"/>
<itunes:subtitle>{{ config.extra.subtitle }}</itunes:subtitle>
{%- for page in pages %}
{%- set episode_meta = episodes_meta[page.slug] -%}
<item>
<title>{{ macros::title(page=page) }}</title>
<link>{{ page.permalink | escape_xml | safe }}</link>
<guid>{{ page.permalink | escape_xml | safe }}</guid>
<pubDate>{{ page.date | date(format="%a, %d %b %Y %H:%M:%S %z") }}</pubDate>
<description><![CDATA[{{ page.description }}]]></description>
<atom:link rel="http://podlove.org/deep-link" href="{{ page.permalink | escape_xml | safe }}#"/>
<enclosure url="{{ get_url(path="episodes/" ~ page.slug ~ "." ~ format.ext) | escape_xml | safe }}" length="{{ episode_meta.formats[format.ext].size }}" type="{{ format.mime_type | escape_xml | safe }}"/>
<itunes:duration>{{ episode_meta.duration }}</itunes:duration>
<itunes:author>{{ config.extra.author }}</itunes:author>
<itunes:subtitle>{{ page.extra.subtitle }}</itunes:subtitle>
<itunes:episode>{{ page.extra.episode }}</itunes:episode>
<itunes:summary>{{ page.description }}</itunes:summary>
<content:encoded><![CDATA[<p><strong>{{ page.extra.subtitle }}</strong></p> <p>{{ page.description}}</p> {{ page.content | safe }}]]></content:encoded>
<psc:chapters xmlns:psc="http://podlove.org/simple-chapters" version="1.2">
{%- for chapter in episode_meta.chapters %}
<psc:chapter start="{{ chapter.start }}" title="{{ chapter.title }}"/>
{%- endfor %}
</psc:chapters>
{%- for contributor in page.extra.contributors %}
<atom:contributor>
<atom:name>{{ contributor }}</atom:name>
</atom:contributor>
{%- endfor %}
</item>
{%- endfor %}
</channel>
</rss>