Nov 19, 2009

Blogger tricks - limiting the posts shown per tag page

Blogger is quite useful and configurable blogging platform but most of the users simply don’t pay enough attention to it. Users have the freedom to change a lot of stuff on their blogs.
I’ll share some tips I find useful here and in some future posts.

How to limit the post count shown at a tag page
The tags are useful in order to maintain your content but the tag pages are too big – the default 20 posts may take too long to load even if your blog don’t have many images or videos. If you have a gaming blog with screenshots – the loading process may look insane.
How to solve this issue?

The solution is simple but first – back up your template.

If you don’t know how to back up it, here is the path:
Go to your blog’s layout page and select the Edit HTML tab. You will see a link – Download Full Template. Click it and save the file on your local disk. Voila, you have your template saved if you mess something later.
If you fail later, use the Upload template form to restore your template from you local hard drive.


Limiting the posts on a label page

What we need to achieve?

Ok, let’s look at a tag page. For example:
http://bestseostrategy.blogspot.com/search/label/blogging

We need to set the variable max-results to something appropriate – let’s say 5. So we must add ?max-results=5 to our url.

http://bestseostrategy.blogspot.com/search/label/blogging?max-results=5

One way is to hardcore the tag urls but this requires too much efforts. The other way is to change the blog template.
Again go to the Layout – Edit HTML tab. Check the Expand Widget Templates checkbox. Now, you can see the full source code of your template.

Find the text

expr:href='data:label.url' 

and change it to

expr:href='data:label.url+ "?max-results=5"'

You may find it multiple times, depending on your template. Fix it everywhere. Save the template and try your tags. They must work fine, now.

If you meet some problems in the process, revert back to your original template and try again. I wish this tip will help.

No comments: