September 10, 2007

All about blog feeds (part 3)

This is the third installment of a short series of posts written to help you achieve a better understanding of your blog feeds, and how you can use them. In this post, I will explain about the "Label" and "Per-post" feeds, and how you can create links to these feeds in your blog.

The URL required to find the feeds for Labels and Per-post comments are very different to those we used to find the blog-wide posts and comments feeds, and require a full post to discuss them! Rather than using the blog's url, we need to use the blog's unique identification number, and in the case of per-post comment feeds, the unique post identification number.

About Label feeds

Let's begin by looking at the format of the Label feed url:

http://www2.blogger.com/feeds/[yourblogID]/posts/[feedType]/-/[labelName]
First we notice that the feed URL is located at "www2.blogger.com", and that the feed is located by your blog's unique identification number. Notice also the "/-/" section: this is what defines the feed as being attributed to a label.

As in the previous examples, the feed type can be default, summary or full. The label name is that of a label you have defined in your blog. This is case sensitive, so ensure you have correctly defined the label name in the url (ie: Blogger is different from blogger).

Only posts can be shown in the label feeds: comments are disabled and cannot be displayed.

You may well want to experiment with this to see your label feeds for yourself. But how do you find your unique blog ID?

How to locate your blog ID

Whenever you create a post, or preview your template, you will notice your unique blog ID in the address bar. It should look something like this:

http://www.blogger.com/rearrange?blogID=7724685150636068124
The numbers highlighted in red would be your blog ID. Of course, this will be different for your own blog than the number shown here, since each blog has a unique identification number.

How to add links to the label feeds in your blog

Once you've experimented with the feeds for different labels, you may well want a way to display links to these feeds too.

You will have to do this manually each time you want to display a link to a particular label feed. You should do this in the format of the example link below, replacing the text and brackets with your own unique values:

< a href="http://www2.blogger.com/feeds/[yourBlogID]/posts/default/-/[labelName]>Subscribe to Label feed</a>
<a href="http://www2.blogger.com/feeds/[yourBlogId]/posts/summary/-/[labelName]>Label Feed</a>
If your labels have spaces between them, you should replace each space with %20 in the feed URL. Here is an example of how I could link to the "Blogger Templates" label feed:
<a href="http://www2.blogger.com/feeds/724793682641096478/posts/default/-/Blogger%20Templates>S|ubscribe for Blogger Templates updates</a>

About Per-Post comments feeds

The Per-Post comments feeds use the regular blog url for the first part, but require the unique post id to define the post from which comments will be extracted. The format of per-post comment feed URLs look like these examples:

http://yourblog.blogspot.com/feeds/[postId]/comments/default
http://www.yourblog.com/feeds/[postId]/comments/summary

To find the unique post ID for an individual post, you will need to edit the post in question and look in the address bar for the post ID. The red text in the url below highlights the post ID for the post you are reading now:

http://www.blogger.com/post-edit.g?blogID=724793682641096478&postID=2922427856369980802

If you want to provide a subscription link for comments to a single post, you can do so in this format, replacing the brackets and PostID with your own unique post ID number:

<a href="http://yourblog.blogspot.com/feeds/[yourPostId]/comments/default>Subscribe to comments for this post</a>

If you would prefer to provide such a link for all of your blog posts, you should follow the instructions on this page which explain how best this can be achieved.

If you use post-pages in your blog, you will usually find a link to the per-post comments feed right at the bottom of the page. (Note: I'm currently working on an "inline comments" hack for Blogger blogs which better highlights the per-post comment feed link, which I shall post about very soon!)

Changing the format, feed type and results for these feeds

As mentioned in part 2 of this series about blog feeds, you can change the format (Atom/RSS), the feed type (default/summary/full) and the maximum number of results shown for these feeds too. The only exceptions are as follows:

  • Label feeds can only show posts, not comments.
  • Per-post comments feeds can only show comments, not post updates

In the next post in this series, I will explain in general how you can syndicate your feed using Feedburner and AddThis.

<-- Part 2

Part 4 -->

Technorati Tags: | | |

Advertise on Blogger Buster

Browse through the Archives

All existing posts are still available to view while I'm working on the site, albeit seen in a much simpler interface. Feel free to browse through the archives to find tutorials, templates and articles to help you build a better blog:

Blog Archive

© Blogger Buster 2010 Home | About | Contact | Hire Me | Privacy Policy