<?xml version="1.0"?>
<rss version="2.0">
    <channel>
        <title><%= config.title %></title>
        <subtitle><%= config.subtitle %></subtitle>
        <icon><%= full_url_for('/assets/favicon.ico') %></icon>
        <link><%= config.url %></link>
        <author>
          <name><%= config.author %></name>
        </author>
        <description><%= config.description %></description>
        <language><%= config.language %></language>
        <pubDate><%= moment(lastBuildDate).locale('en').format('ddd, DD MMM YYYY HH:mm:ss ZZ') %></pubDate>
        <lastBuildDate><%= moment(lastBuildDate).locale('en').format('ddd, DD MMM YYYY HH:mm:ss ZZ') %></lastBuildDate>
        <%_ for (item of (config.keywords ? config.keywords.split(',') : [])) { _%>
        <category term="<%= item %>" />
        <%_ } _%>
        <%_ for (const post of posts) { _%>
        <item>
            <guid isPermalink="true"><%= post.permalink %></guid>
            <title><%= post.title %></title>
            <link><%= post.permalink %></link>
            <%_ for (const { name, path } of (post.categories ? post.categories.toArray() : [])) { _%>
            <category term="<%= name %>" scheme="<%= full_url_for(path) %>" />
            <%_ } _%>
            <%_ for (const { name, path } of (post.tags ? post.tags.toArray() : [])) { _%>
            <category term="<%= name %>" scheme="<%= full_url_for(path) %>" />
            <%_ } _%>
            <pubDate><%= moment(post.date).locale('en').format('ddd, DD MMM YYYY HH:mm:ss ZZ') %></pubDate>
            <description><![CDATA[ <%= post.content %> ]]></description>
        </item>
        <%_ } _%>
    </channel>
</rss>
