September 09, 2007

All about blog feeds (part 2)

This is the second 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 how to find the main posts and comments feeds and how to make them available for your readers to subscribe to them.

Your main posts and comments feeds are the easiest feeds to find, and are also the feeds which Bloggers are most familiar with. By default, Blogger publishes these feeds in Atom format.

These feeds are found at the following URLs (where YOURBLOG is replaced by the name of your blog):

  • For the main posts feed: http://yourblog.blogspot.com/feeds/posts/default
    Or if you are publishing to a custom domain: http://www.yourdomain.com/feeds/posts/default
  • It can also be found at: http://yourblog.blogspot.com/atom.xml
  • For the main comments feed: http://yourblog.blogspot.com/feeds/comments/default
    Or if you are publishing to a custom domain: http://www.yourdomain.com/feeds/posts/default

You can change the settings of your blog feed, be it for the posts or comments feed, by changing elements of the URL and adding variables to it. The variables you can change are:

  • The feed type (Atom/RSS)
  • The maximum number of results (posts or comments) that are displayed.
  • The amount of text displayed (summary or full)
So let's look at the feed URL in another way:
http://yourblog.blogspot.com/feeds/[posts/comments]/TYPE/[variables defined here]
The feed type (Atom/RSS) and the maximum number of results are defined using variables which are added to the end of the URL. The amount of text displayed is controlled by the TYPE section within the default url.

Changing the amount of text to be displayed

Let's start with an explanation of the type. This can be either "full" (which displays the whole post or comment) or "summary" (which displays the first 250 characters or so). The "default" setting defers to whatever settings you have defined in your Blogger dashboard (which I will talk about in a later post). Using either "full" or "summary" in the url for your blog feed will override any settings you have defined in your Blogger dashboard. Here are examples of how this setting can be used:

http://yourblog.blogspot.com/feeds/posts/summary
http://www.yourblog.com/feeds/comments/full

Changing the feed format

To change the feed from Atom to RSS format, you need to add this variable to the end of the feed url:

?alt=rss
The question mark tells the browser that variables will be added to the feed url, while the "alt" function defines the alternative feed format (in this case, the alternative is RSS). Here are examples of how this can be used:
http://yourblog.blogspot.com/feeds/comments/default?alt=rss
http://www.yourblog.com/feeds/posts/summary?alt=rss

Changing the maximum number of results to be displayed

Once again, variables at the end of the feed URL are used to change the maximim number of results to be displayed. This can be any number from 1-999, and is defined by adding ?max-results=[insert number here] to the end of the feed URL. Here are a few examples:

http://yourblog.blogspot.com/feeds/posts/full?max-results=100
http://www.yourblog.com/feeds/comments/summary?max-results=10

By default, the feeds will return with a start index of 1; that is, they begin with the first newest post or comment. If you want to skip a few results, and start with the third post/comment for example, you can change this by adding ?start-index=3 to the end of the feed url, like this:

http://yourblog.blogspot.com/feeds/posts/default?start-index=3

Chaining variables in your feed urls

If you would like to ad more than one variable to your blog feed urls, you can do so by inserting an ampersand (&) between the variables, as in these examples:

http://yourblog.blogspot.com/feeds/posts/default?alt=rss&max-results=100
http://www.yourblog.com/feeds/comments/summary?max-results=10&start-index=5
http://yourblog.blogspot.com/feeds/posts/full?alt=rss&max-results=15&start-index=2
In this case, you do not need to add the question mark (?) to all of the variables, only the first one to be defined. The browser understands that variables will be added when you include the first question mark after the regular feed url, so you don't need to add any more!

How to offer these feeds for readers to subscribe

Now that you understand the URLs to find the various site-wide feeds for your blog, and how to add variables to change them, you would probably like to offer these feeds to your readers so that they can subscribe to them. You can add these feed URLs to your template like any other link, either as a text link, or an image link. Here are some examples using feeds from Blogger Buster, with an explanation of how they are achieved:

A text link to the main Blogger Buster posts feed, changed to RSS format, summarized with 50 maximum results:

Subscribe to Blogger Buster Posts feed (summary only)

This is achieved by adding this section of code, which you could use in your sidebar:
<a href="http://www.bloggerbuster.com/feeds/posts/summary?alt=rss&max-results=100">Subscribe to Blogger Buster Posts feed (summary only)</a>
An image link to the Blogger Buster comments feed, with full comments displayed and a start-index of 3:



This is achieved using this section of code:

<a href="http://www.bloggerbuster.com/feeds/comments/full?start-index=3"><img src="http://templates.bloggerbuster.com/feed.gif" border="0"/></a>

You can experiment with different text links and images to suit your blog's style and requirements.

Many of your feed subscribers will add the feed url to their feed reader, or will subscribe using the automatic selection in the Firefox internet browser. You can make it even easier for users to subscribe by using your feed URLs to create Feedburner or AddThis feed widgets, as I will describe in a later installment of this series about blog feeds.

Summary

I hope this post has helped you understand the basics of your feed urls, how the settings can be changed by altering the URL and adding variables, and how these links can be provided in your template for users to subscribe to them.

In the next post of this series, I will explain about Label and Per-Post Comments feeds, which are a little more complicated to find (and even more difficult to feature as subscription links in your template!).

<-- Part 1

Part 3 -->

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