]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Resources/views/themes/common/Entry/entries.xml.twig
Changed RSS to Atom feed and improve paging
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Resources / views / themes / common / Entry / entries.xml.twig
index d70aa5dc9c99e58fa043d47183ae5e936e0a164f..0a0131cde3c384d7d92f08c57db6ddfdb2b6ad0f 100644 (file)
@@ -1,34 +1,46 @@
 <?xml version="1.0" encoding="utf-8"?>
-<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:media="http://search.yahoo.com/mrss/">
-    <channel>
-        <title>wallabag - {{ type }} feed</title>
-        <link>{{ url_html }}</link>
-        <link rel="self" href="{{ app.request.uri }}"/>
-        {% if entries.hasPreviousPage -%}
-            <link rel="previous" href="{{ url }}?page={{ entries.previousPage }}"/>
-        {% endif -%}
-        {% if entries.hasNextPage -%}
-            <link rel="next" href="{{ url }}?page={{ entries.nextPage }}"/>
-        {% endif -%}
-        <link rel="last" href="{{ url }}?page={{ entries.nbPages }}"/>
-        <pubDate>{{ "now"|date('D, d M Y H:i:s') }}</pubDate>
-        <generator>wallabag</generator>
-        <description>wallabag {{ type }} elements</description>
-
-        {% for entry in entries %}
-
-            <item>
-                <title><![CDATA[{{ entry.title|e }}]]></title>
-                <source url="{{ url('view', { 'id': entry.id }) }}">wallabag</source>
-                <link>{{ entry.url }}</link>
-                <guid>{{ entry.url }}</guid>
-                <pubDate>{{ entry.createdAt|date('D, d M Y H:i:s') }}</pubDate>
-                <description>
-                    <![CDATA[{%- if entry.readingTime > 0 -%}{{ 'entry.list.reading_time_minutes'|trans({'%readingTime%': entry.readingTime}) }}{%- else -%}{{ 'entry.list.reading_time_less_one_minute'|trans|raw }}{%- endif %}{{ entry.content|raw -}}]]>
-                </description>
-            </item>
-
+<feed xmlns="http://www.w3.org/2005/Atom">
+    <title>wallabag — {{type}} feed</title>
+    <subtitle type="html">RSS feed for {{ type }} entries</subtitle>
+    {% if entries | length > 0 %}
+        <updated>{{ (entries | first).createdAt | date('c') }}</updated> {# Indicates the last time the feed was modified in a significant way. #}
+    {% endif %}
+    <id>wallabag:{{ domainName | removeScheme | removeWww }}:{{ user }}:{{ type }}</id>
+    <link rel="alternate" type="text/html" href="{{ url(type) }}"/>
+    <link rel="self" type="application/atom+xml" href="{{ app.request.uri }}"/>
+    {% if entries.hasPreviousPage %}
+        <link rel="previous" href="{{ url }}/{{ entries.previousPage }}"/>
+    {% endif -%}
+    {% if entries.hasNextPage %}
+        <link rel="next" href="{{ url }}/{{ entries.nextPage }}"/>
+    {% endif -%}
+    <link rel="last" href="{{ url }}/{{ entries.nbPages }}"/>
+    <generator uri="http://wallabag.org" version="{{ version }}">wallabag</generator>
+    <author>
+        <name>{{ user }}</name>
+    </author>
+    <icon>{{ asset('favicon.ico') }}</icon>
+    <logo>{{ asset('bundles/wallabagcore/themes/_global/img/logo-square.png') }}</logo>
+    {% for entry in entries %}
+    <entry>
+        <title><![CDATA[{{ entry.title|e }}]]></title>
+        <link rel="alternate" type="text/html"
+              href="{{ url('view', {'id': entry.id}) }}"/>
+        <link rel="via">{{ entry.url }}</link>
+        <id>wallabag:{{ domainName | removeScheme | removeWww }}:{{ user }}:entry:{{ entry.id }}</id>
+        <updated>{{ entry.updatedAt|date('c') }}</updated>
+        <published>{{ entry.createdAt|date('c') }}</published>
+        {% for tag in entry.tags %}
+            <category term="{{ tag.slug }}" label="{{ tag.label }}" />
         {% endfor %}
-
-    </channel>
-</rss>
+        {% for author in entry.publishedBy %}
+        <author>
+            <name>{{ author }}</name>
+        </author>
+        {% endfor %}
+        <content type="html" {% if entry.language %}xml:lang="{{ entry.language[:2] }}"{% endif %}>
+            <![CDATA[{%- if entry.readingTime > 0 -%}{{ 'entry.list.reading_time_minutes'|trans({'%readingTime%': entry.readingTime}) }}{%- else -%}{{ 'entry.list.reading_time_less_one_minute'|trans|raw }}{%- endif %}{{ entry.content|raw -}}]]>
+        </content>
+    </entry>
+    {% endfor %}
+</feed>