Tag Archives: RSS icon

Adding RSS icons to a joomla template

We’re using Joomla on Vquence’s corporate site and wanted to display RSS icons and provide proper feeds for the blogs and news posted there.

The new Joomla 1.5 provides the ability to add to every Menu item that is a Blog List an RSS feed by introducing an rss and atom link tag in the html head tag. However, we wanted to have the RSS icon for subscriptions displayed on the page, too, and that turned out to be not so simple.

Here is the piece of code that we eventually added to our body tag:

<div id="rss" style="float: right;" >
<?php $headData = $this->getHeadData() ?>
<?php if(count($headData['links']) != 0) : ?>
<a href="<?php echo JRoute::_('index.php?format=feed&type=atom', false) ?>"><img src="/images/rss.gif" alt="rss icon"/></a>
<?php endif; ?>
</div>

Fortunately, this also worked for the aggregated planet blog feed we are displaying in Joomla as an article under Team Blog and for which we had to install the CustomHeadTag plugin to add the link tags to the html page head.

Counting the number of links in the Joomla HeadData seemed to be the best way to find out whether or not to add the RSS feed icon. This is in no way or shape optimal or the best solution, but we were unable to find a way to get directly to the parameters of the menu items and query that show_feed_link parameter of the menu item. Online documentation for this type of template work is non-existent as yet.

If anyone has a better solution, leave a comment!