Antti Kaihola avatar Antti Kaihola committed cf2c3fc

Added RSS autodiscovery

Comments (0)

Files changed (4)

tinkerer/ext/rss.py

     # feed pubDate is equal to latest post pubDate
     context["pubDate"] = context["items"][0]["pubDate"]
 
-    yield ("rss", context, "rss.html")
+    yield ("feed/index", context, "feed/index.html")
 

tinkerer/themes/tinkerbase/feed/index.html

+<?xml version="1.0" encoding="utf-8"?>
+<rss version="2.0">
+    <channel>
+        <title>{{ title }}</title>
+        <link>{{ link }}</link>
+        <description>{{ description }}</description>
+        <language>{{ language }}</language>
+        <pubDate>{{ pubDate }}</pubDate>
+        {% for item in items %}
+        <item>
+            <link>{{ item.link }}</link>
+            <guid>{{ item.link }}</guid>
+            <title>{{ item.title }}</title>
+            <description><![CDATA[{{ item.description }}]]></description>
+            <pubDate>{{ item.pubDate }}</pubDate>
+        </item>
+    {% endfor %}
+    </channel>
+</rss>

tinkerer/themes/tinkerbase/layout.html

 
 {# RSS link #}
 {%- macro rss_link() %}
-    <a href="{%- if rss_service %}{{ rss_service }}{%- else %}{{ pathto('rss') }}{%- endif %}" title="Subscribe via RSS">
+    <a href="{%- if rss_service %}{{ rss_service }}{%- else %}{{ pathto('feed/').rsplit('/', 1)[0] }}/{%- endif %}" title="Subscribe via RSS">
         <div class="rss">
             {%- if rss_symbol %}<span class="webfont">B</span>{%- endif %}
             {% if rss_link_text %}{{ rss_link_text }}{% endif %}
 
 {# Blocks ------------------------------------------------------------------- #}
 
+{%- block linktags %}
+    {{ super() }}
+    <link rel="alternate" type="application/rss+xml" title="RSS"
+          href="{%- if rss_service %}{{ rss_service }}{%- else %}{{ pathto('feed/').rsplit('/', 1)[0] }}/{%- endif %}">
+{%- endblock %}
+
 {%- block header %}
     {%- if page_nav_first %}{{ page_nav() }}{%- endif %}
     {{ blog_header() }}

tinkerer/themes/tinkerbase/rss.html

-<?xml version="1.0" encoding="utf-8"?>
-<rss version="2.0">
-    <channel>
-        <title>{{ title }}</title>
-        <link>{{ link }}</link>
-        <description>{{ description }}</description>
-        <language>{{ language }}</language>
-        <pubDate>{{ pubDate }}</pubDate>
-        {% for item in items %}
-        <item>
-            <link>{{ item.link }}</link>
-            <guid>{{ item.link }}</guid>
-            <title>{{ item.title }}</title>
-            <description><![CDATA[{{ item.description }}]]></description>
-            <pubDate>{{ item.pubDate }}</pubDate>
-        </item>
-    {% endfor %}
-    </channel>
-</rss>
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.