Daniel Cazzulino's Blog : Blogger: how to provide label/tag feeds

Subscriptions

News

Source code published in this blog is public domain unless otherwise specified.

 

kzu in LinkedIn

  Microsoft MVP Profile

 Contact

Post Categories

Blogger: how to provide label/tag feeds

By default, blogger will only render links to the pages where you can read all entries with given labels:

BloggerLabels

If you want to expose a feed so that people can subscribe to receive only entries with the given label, here's what you need to do:

  1. Go to the Template -> Edit HTML tab on your feed management page:

    BloggerEditHTML 
  2. Make sure to check "Expand Widget Templates"
  3. Do a "find" for "data:labels". That will take you to the markup where the labels are iterated to build the links.
  4. Inside the div with a class='widget-content', change the code as follows:

    original:
    <b:loop values='data:labels' var='label'>
      <li>
        <b:if cond='data:blog.url == data:label.url'>
          <data:label.name/>
        <b:else/>
          <a expr:href='data:label.url'><data:label.name/></a>
        </b:if>
        (<data:label.count/>)
      </li>
    </b:loop>
    change to:
    <b:loop values='data:labels' var='label'>
      <li>
      <link expr:href='data:blog.homepageUrl + "feeds/posts/default/-/" + data:label.name + "?alt=rss"' expr:title='data:label.name + " Feed"' rel='alternate' type='application/rss+xml'/>
      <a expr:href='data:blog.homepageUrl + "feeds/posts/default/-/" + data:label.name + "?alt=rss"'>
        <img alt='Subscribe' src='http://www.feedburner.com/fb/images/pub/feed-icon16x16.png' style='vertical-align:middle;border:0'/></a>
        <b:if cond='data:blog.url == data:label.url'>
          <data:label.name/>
        <b:else/>
          <a expr:href='data:label.url'><data:label.name/></a>
        </b:if>
        (<data:label.count/>)
      </li>
    </b:loop>


Now the rendering is as follows:

BloggerLabelsRss

Enjoy!

posted on Friday, November 16, 2007 8:35 AM by kzu