<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0"
  xmlns:atom="https://www.w3.org/2005/Atom"
  xmlns:dc="https://purl.org/dc/elements/1.1/">
  <channel>
    <!-- Mandatory elements -->
    <title>{{ feed.title }}</title>
    <description>{{ feed.description|e }}</description>
    <link>{{ feed.html_url }}</link>
    <atom:link href="{{ feed.rss_url }}" rel="self" type="application/rss+xml" />

    <!-- Optional elements -->
    {% if feed.author is defined %}<managingEditor>{{ feed.author }}</managingEditor>{% endif %}
    {% if feed.category is defined %}<category>{{ feed.category }}</category>{% endif %}
    {% if feed.repo_url is defined %}<docs>{{ feed.repo_url }}</docs>{% endif %}
    {% if feed.language is defined %}<language>{{ feed.language }}</language>{% endif %}

    <!-- Timestamps and frequency -->
    <pubDate>{{ feed.pubDate }}</pubDate>
    <lastBuildDate>{{ feed.buildDate }}</lastBuildDate>
    <ttl>{{ feed.ttl }}</ttl>

    <!-- Credits -->
    <generator>{{ feed.generator }}</generator>

    <!-- Feed illustration -->
    {% if feed.logo_url is defined %}
    <image>
      <url>{{ feed.logo_url }}</url>
      <title>{{ feed.title }} - Illustration</title>
      <link>{{ feed.html_url }}</link>
    </image>
    {% endif %}

    <!-- Entries -->
    {% for item in feed.entries %}
    <item>
      <title>{{ item.title }}</title>
      <description>{{ item.description|e }}</description>
      <link>{{ item.link }}</link>
      <pubDate>{{ item.pubDate }}</pubDate>
      <source url="{{ feed.rss_url }}">{{ feed.title }}</source>
      <guid isPermaLink="true">{{ item.link }}</guid>
      {% if item.image is defined %}<enclosure url="{{ item.image[0] }}" type="{{ item.image[1] }}" />{% endif %}
    </item>
    {% endfor %}
  </channel>
</rss>
