Patch: Add <icon> and <image> tags to feeds

Lars Ljung lars at matholka.se
Thu Sep 10 21:40:37 EST 2009


Hi,

I needed to add <icon> and <image> tags to my Atom and RSS feeds. Here
is a patch that adds an "icon" configuration setting (it should be an URL).

Regards,
Lars Ljung

=== modified file 'planet/config.py'
--- planet/config.py    2007-08-20 02:13:00 +0000
+++ planet/config.py    2009-09-10 08:11:39 +0000
@@ -106,6 +106,8 @@
     define_planet('output_dir', 'output')
     define_planet('spider_threads', 0)

+    define_planet('logo', None)
+
     define_planet_int('new_feed_items', 0)
     define_planet_int('feed_timeout', 20)
     define_planet_int('cache_keep_entries', 10)

=== modified file 'planet/splice.py'
--- planet/splice.py    2007-06-15 16:22:54 +0000
+++ planet/splice.py    2009-09-10 08:11:39 +0000
@@ -35,6 +35,9 @@
     createTextElement(author, 'email', config.owner_email())
     feed.appendChild(author)

+    if config.logo():
+        createTextElement(feed, 'logo', config.logo())
+
     if config.feed():
         createTextElement(feed, 'id', config.feed())
         link = doc.createElement('link')

=== modified file 'themes/common/rss20.xml.tmpl'
--- themes/common/rss20.xml.tmpl        2006-10-19 02:38:39 +0000
+++ themes/common/rss20.xml.tmpl        2009-09-10 11:27:58 +0000
@@ -6,6 +6,13 @@
        <link><TMPL_VAR link ESCAPE="HTML"></link>
        <language>en</language>
        <description><TMPL_VAR name ESCAPE="HTML"> - <TMPL_VAR link
ESCAPE="HTML"></description>
+<TMPL_IF logo>
+       <image>
+               <title><TMPL_VAR name ESCAPE="HTML"></title>
+               <link><TMPL_VAR link ESCAPE="HTML"></link>
+               <url><TMPL_VAR logo></url>
+       </image>
+</TMPL_IF>

 <TMPL_LOOP Items>
 <item>


More information about the devel mailing list