gitweb: channel image in rss feed
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Mon, 26 Jan 2009 11:50:11 +0000 (12:50 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 28 Jan 2009 22:13:54 +0000 (14:13 -0800)
Define the channel image for the rss feed when the logo or favicon are
defined, preferring the former to the latter. As suggested in the RSS
2.0 specifications, the image's title and link as set to the same as the
channel's.

Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
gitweb/gitweb.perl
index 931db4f7ebb7e789278ac3e20a8570d40873163e..f8a5d2e07766530369cdd8b8c36703c3372b5690 100755 (executable)
@@ -6075,6 +6075,16 @@ sub git_feed {
                      "<link>$alt_url</link>\n" .
                      "<description>$descr</description>\n" .
                      "<language>en</language>\n";
+               if (defined $logo || defined $favicon) {
+                       # prefer the logo to the favicon, since RSS
+                       # doesn't allow both
+                       my $img = esc_url($logo || $favicon);
+                       print "<image>\n" .
+                             "<url>$img</url>\n" .
+                             "<title>$title</title>\n" .
+                             "<link>$alt_url</link>\n" .
+                             "</image>\n";
+               }
        } elsif ($format eq 'atom') {
                print <<XML;
 <feed xmlns="http://www.w3.org/2005/Atom">