Logo In RSS Feed – In WordPress Blogs And Elsewhere

I have been having the need (or want, as you may see fit) to display a logo in my RSS feed – for my WordPress powered blog as well as home-cooked Showcase. Couple things one needs to keep in mind when designing such logos is the following (information summarized from here):

  1. Maximum value for width is 144, default value is 88
  2. Maximum value for height is 400, default value is 31

In the following two sub-sections, I will show what I did to accomplish this thing.


Case #1. A WordPress Blog

It’s fairly simple to achieve it in that the following lines need to be put into functions.php, found within the theme of your choice. WordPress-provided hook, add_action(‘rss2_head’, ‘function_name’), puts this information in an appropriate place within the RSS feed.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
add_action('rss2_head', 'my_logo_rss');
 
# The value of <url> tag needs to point to the image. It DOES NOT have
# to be within the WordPress folder.
function my_logo_rss() {
  echo "<image>\n";
  echo "\t<title>" . get_journalinfo('title') . "</title>\n";
  echo "\t<url>" . get_journalinfo('siteurl)'. "/site_logo_rss.png</url>\n";
# echo "\t<url>http://your-site.com/images/site_logo_rss.png</url>\n";
  echo "\t<link>" . get_journalinfo('url') . "</link>\n";
  echo "\t<width>32</width>\n";
  echo "\t<height>32</height>\n";
  echo "\t</image>\n";
}



Logo in RSS Feed

Logo In RSS Feed – A WordPress Blog


Case #2. A Non-WordPress Blog

It’s fairly simple to achieve it even here – as long as one has access to a program/PHP file that generates the RSS feed. Add the following lines to the program, just before the first <item> begins (with values appropriate to your site of course), and that’s about it.


1
2
3
4
5
6
7
echo "\t<image>\n";
echo "\t<title>scenic stopovers</title>\n";
echo "\t<url>http://sgowtham.com/images/site_logo_rss.png</url>\n";
echo "\t<link>http://sgowtham.com/</link>\n";
echo "\t<width>32</width>\n";
echo "\t<height>32</height>\n";
echo "\t</image>\n";



Logo in RSS Feed

Logo In RSS Feed – A non-WordPress Blog



This Does NOT Seem To Be Working!

Believe it or not, it didn’t work for me either – not at least until I cleared out the browser cache and hit the refresh/reload button. I have heard that most RSS readers still don’t recognize this icon/logo thing yet but it doesn’t hurt to have it – when it does show up, it sure does feed our ego!

One Reply to “Logo In RSS Feed – In WordPress Blogs And Elsewhere”

  1. [… – sgowtham.com is other nice source of information. Online Car insurance claims [… –

Comments are closed.