RSS

My Drupal Blog RSS Feeds Updated

Just a quick note to say that the My Drupal Blog RSS feeds have been updated.

The local URLs are still the same:
Posts - http://mydrupalblog.lhmdesign.com/rss.xml
Comments - http://mydrupalblog.lhmdesign.com/crss

But the FeedBurner URLs are now slightly different:
Posts - http://feeds2.feedburner.com/MyDrupalBlog
Comments - http://feeds2.feedburner.com/MyDrupalBlog-Comments

Overriding Drupal's Default RSS Feed Icon

By default, a number of Drupal themes (including Garland) output an RSS feed icon Feed icon at the bottom of pages which generate a feed. The feed icon is generated because of the existence of the following code in the page.tpl.php file

<?php print $feed_icons ?>

But what if you want a different looking icon? Maybe something larger, or a different color?

Well, there are a couple of ways to achieve this:

  • The not-so right way
  • The right way

1. The not-so right way

Drupal's default RSS feed icon image is located in your site's folder structure at 'misc/feed.png'. The not-so right way to change it is to simply swap this feed.png image for another feed icon image (just making sure to also name the new image feed.png).

This method will work, but is not recommended. The reason being, that you are effectively overwriting a core file. When you do an upgrade of Drupal, your new feed.png image will be replaced with the original feed.png image and you will need to update it again. This is clearly not a good idea if you have lots of sites or are doing sites for clients who do not know how to do such updates, and ultimately it's just an all round messy solution.

So, a far better solution would be one where we do not alter any core stuff, and the new feed icon remains in place even after an upgrade...this is the right way.

2. The right way

The first thing we need to do is find out what function Drupal is using to output the feed icon. So, go over to Drupal API, and do a search for feed_icon. The search should return one result - theme_feed_icon. This is exactly what we're after. Anytime you see the word 'theme_' at the beginning of a function it means that we can override the function - which is what we want to do in this case.