Senin, 14 Juli 2008

Increase Your Recent Posts and Comments to 10 - Blogger Hack

Before you get too excited and try the tricks in this post, I just wanted to let you know beforehand that it might not work anymore. Several visitors have tried and told me it didn’t work so the result might be the same for you. Blogger continues to make changes without announcing them so hacks and tricks expire which makes it frustrating for everyone. If you’re willing to try and increase your recent posts and comments to 10, then continue reading. I apologize in advance if it doesn’t work for you.

By default, Blogger is very limited in comparison to features or plugins available to WordPress blog users. For example, there are free plugins for WordPress that allow you to show your most recent posts, most popular posts, and most recent comments.

Blogger, on the other hand, doesn’t have that functionality but people have figured out a clever way to do it anyhow. If you haven’t already read our How to Setup Your Recent Posts and Recent Comments Blogger Page Elements then you might want to start there first before reading on.

This article will take Blogger users to the next level and allow you to do things like increase the default max posts from 5 to 10 (or whatever size you want), filter by category, or filter by a date range, etc. It’s actually pretty powerful and I’m happy to share my secrets with you.
How to Increase Your Post Limit

There’s a cool way to increase the number of recent posts showing up in your rss feed widget. All you need to do is add the parameter “?max-results=10” (or whatever number you want to return is) to the end of your existing feed url. So your new feed widget url should look something like this:

http://YOUR-BLOG-NAME-HERE.blogspot.com/feeds/posts/default/?max-results=10

Pretty cool huh? Now it might not work right away in your feed widget so to make sure it’s working properly is to view it in your browser. Yup, just put it right into your browser window and you’ll see if it’s working properly because trying to troubleshoot it after it’s in your rss feed widget is really tough — especially since it doesn’t always update right away.
Filter Your Post List by Category (Tag, Label)

Say you only want to show a certain list of posts based on category in your rss feed widget. Well, now you can by using the “category” parameter. Here’s what your url would look like:

http://YOUR-BLOG-NAME-HERE.blogspot.com/feeds/posts/default/-/cure/

I was only able to get this to work with one category but according to the example below, you can filter by multiple categories. If any of you are able to get that to work, please let me know.
Filter Your Post List by a Date Range

If you wanted to restrict your feed results to a certain time frame you can. I can’t think of a good reason for me to personally read this since I always want the latest posts to be listed but the filter is here to use regardless. Here’s an example which will only show posts that were published between 1/16/2008 - 2/28/2008:

http://YOUR-BLOG-NAME-HERE.blogspot.com/feeds/posts/default/?published-min=2008-01-
16T00:00:00&published-max=2008-02-28T23:59:59

You can also substitute the published-min and published-max with updated-min and updated-max if you wanted to filter by updated dates instead of published dates.
Order By Filter

I actually don’t ever modify this since the default order by filter is lastmodified or createdate which makes the most recent post appear first on the list. If you wanted to change this for some reason you easily could by using the “orderby” filter.
Start Index Filter

This one could be handy if you wanted to skip certain posts and start listing after, say the 1st post. Maybe you have a section where you feature the latest post on your blog and you don’t want it to also show up first in your rss feed. This is the filter you would use. An example of the “start-index” filter would be:

http://YOUR-BLOG-NAME-HERE.blogspot.com/feeds/posts/default/?start-index=2

This would essentially skip and not show your latest post and post #2 would come up first. Be careful if you do this and later wonder why your first post isn’t show up.
Multiple Parameter Example

You can combine all these filters into one url and really fine tune your results if you wanted to. Let’s say you want to show your 10 most recent posts filtered by the “book” category (label, tag). Your feed url would look something like this:

http://YOUR-BLOG-NAME-HERE.blogspot.com/feeds/posts/default/-/cure/?max-results=10

Another example would be to show 10 most recent posts filtered by a date range:

http://YOUR-BLOG-NAME-HERE.blogspot.com/feeds/posts/default/?published-min=2008-01-
16T00:00:00&published-max=2008-02-28T23:59:59&max-results=10

Here’s a list of all the query parameters you can change for any Blogger rss feed. I wouldn’t worry about the “alt” one but the rest are pretty useful to know.

* alt - the type of feed to return, such as atom (the default) or rss.
* orderby - the order to return entries, such as lastmodified (the default) and starttime.
* max-results - the maximum number of entries to return.
* /category - specifies categories (i.e. labels) to filter the feed results. For example, http://www.blogger.com/feeds/blogID/posts/default/-/Fritz/Laurie will return entries labeled with Fritz AND Laurie.
* updated-min, updated-max - the bounds on entry update dates.
* published-min, published-max - the bounds on entry publication dates.
* start-index - 1-based index of the first result to be retrieved (for paging).

Now that you are familiar with all your rss feed url options, you can really customize your Blogger recent posts and comments sections. Many of you have asked me how to increase your feed limit from 5 to 10 so now you can. In some cases I had to completely delete my recent comments widget and install it again for the filters to correctly work. I’m not sure why but you might run into a similar issue.

Tidak ada komentar: