Seventh Sense Rambling about life's little things, in 7 ≡ 1 (mod 6) fashion

« | »

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_bloginfo('title') . "</title>\n";
  echo "\t<url>" . get_bloginfo('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_bloginfo('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.net/images/site_logo_rss.png</url>\n";
echo "\t<link>http://sgowtham.net/</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!

Share
divider

Responses to Logo In RSS Feed – In WordPress Blogs And Elsewhere

  1. Online Car Insurance >> http://onlinecarinsuranceclaims.com/ says:

    [... - sgowtham.net is other nice source of information. Online Car insurance claims [... -

  2. Super-Duper website! I am loving it!!?! Will appear again again – taking you feeds also, Thanks.

  3. Na Kubal says:

    Is there any way to trackback your post on my website Colonie de vacances ?



Leave a Reply

Most of these posts, especially the ones with any hint of technical jargon, are intended to be Note2Self. But if any of them float your boat, then feel free to sail along. If you feel so generous, improve my journey with your comments &/or thoughts!
Looking for MS Thesis or PhD Dissertation Template in LaTeX? Click below!

MTU Create The Future
Twitter



Archives

Planet Kannada


Twitter: @sgowtham Facebook: @sgowtham Linked In: sgowtham