12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?xml version="1.0" encoding="utf-8"?>
- <feed xmlns="http://www.w3.org/2005/Atom">
- {% spaceless %}
- <title>{{ site_title }}</title>
- <link href="{{ current_page.url }}" rel="self"/>
- <subtitle>
- {% if config.tagblog.site_description %}
- {{ config.tagblog.site_description }}
- {% else %}
- Blog feed
- {% endif %}
- </subtitle>
- {# <language>en-us</language> #}
- <updated>{{ "now"|date("Y-m-d\\TH:i:sP") }}</updated>
- <id>{{ base_url }}</id>
- {% if config.tagblog.feed.limit %}
- {% set limit = config.tagblog.feed.limit %}
- {% else %}
- {% set limit = 10 %}
- {% endif %}
- {# it is not easy to break out of a loop in twig: stackoverflow.com/a/29161205 #}
- {% set break = false %}
- {% set count = 0 %}
- {% for page in pages if not break %}
- {% if page.meta.tags %}
- <entry>
- <title>{{ page.title }}</title>
- <link href="{{ page.url }}" rel="alternate"/>
- <updated>{{ page.date_formatted|date("Y-m-d\\TH:i:sP") }}</updated>
- <published>{{ page.date_formatted|date("Y-m-d\\TH:i:sP") }}</published>
- {% if page.author %}
- <author><name>{{ page.author }}</name></author>
- {% endif %}
- {% for tag in page.meta.tags|split(',') %}
- <category term="{{ tag }}"/>
- {% endfor %}
- <id>{{ page.url }}</id>
- {% if config.tagblog.feed.content is defined and config.tagblog.feed.content %}
- <content><![CDATA[{{ page.id|content }}]]></content>
- {% else %}
- <summary><![CDATA[{% if page.description %}{{ page.description }}{% else %}{{ page.id|content|striptags|slice(0, 300) }}...{% endif %}]]></summary>
- {% endif %}
- </entry>
- {% set count = count + 1 %}
- {% if count == limit %}{% set break = true %}{% endif %}
- {% endif %}
- {% endfor %}
- {% endspaceless %}
- </feed>
|