Sunday, July 22, 2007


Limit Number of Posts Per Page for Label Widget Or Tag Cloud

Yep, another blogger hack while I am at it. This time is improving upon the user experience and blog organization. It divides into 3 parts targeting bloggers with different blog settings.
(1) It is for general bloggers.
(2) This is for bloggers using label widget and like to limit number of post per label page.
(3) It is intend only for bloggers adapted/adapting to label cloud widget and too like to know how to place limitation on number of posts per page.

(1)Limit # of posts per page(beginner):Bloggers already know this part can jump straight to next section!
You should know that Blogger allows anyone to easily set the limit on number of posts per page in Dashboard. So if you have like over 50 posts with lots of multimedia contents in one page, may I suggest that it is good time to think about what that can do to some readers still running on 50k speed! You can succinctly set it up in no time and here is how:
1. Log into your blog and in dashboard, click on settings.
2. Click on formatting and on the first setting is "show" option which is the place where you can limit by posts or days.
3. Be sure to scroll down the end of page and hit "save settings" before you view your blog page!
4 That is it, every page load now limit by your "show" setting!

Now, on to the intermediate level for bloggers who are more experienced with blogger template and like to do something about their label results...

(2)Limit number of posts for normal blogger label widget(intermediate): *if you used phydeaux3's label cloud, skip over to next, you don't need to do this one!
By default, Blogger limits 20 posts per page for labels, so if you have a label with 30 posts, you will need to browse 2 pages till the oldest post on that label. It is good since 20 posts seem like reasonable posts per page with contents "fully displayed". However, limitation is there for folks with content summary only using expandable posts(like read more.../read full post...). With only 20 posts for this instance, it loads fairly quick, so 20 posts seem like too small for a label that has 100+ posts! Think about how many click to get to that last post forbid it actually is what you are looking for(well search is better way, but...). Now, you can still control the number of posts per label page, just like this time you have to do it in code, here is the step by Hackosphere's How to control the number of posts in label pages:
1. Back up you template and copy the "expanded" widgets template from edit HTML and paste to your html editors.
2. Search for "occurrences" of data:label.url
3. Replace over these occurrences with data:label.url + "?max-results=30", you can change the number after "results=" for your posts limitation
4. copy all and paste back to edit template html and hit "save template"
5. check now to see when you click one label with 100 posts and it will only return 30 posts per label page!
This hack is simple and straight forward as well!

(3)Limit number of posts per page for phydeaux3's label cloud:
for bloggers who use it ONLY!
Ok, next one is aiming for bloggers who has adapted the popular phydeaux3's label cloud widget for blogger(advanced...well sorta):
Note, this hack is a bit different from Hackosphere, since he was targeting "earlier" version of phydeaux3's label cloud hack! For the new blogger label cloud widget hack, you are in the right place!
1. same step, have your blog template html code in your editor and search for encodeURIComponent(t)
With the latest phydeaux3's label cloud code you should see:
a.href = '/search/label/'+encodeURIComponent(t)
2. now add +'?max-results=30'; after encodeURIComponent(t) and again you can change the number after max-results= at your command!
3. Save it in edit html template and save it, done!
Again this one is for new blogger tag cloud widget, if you are still using label cloud for blogger beta or classic blogger template, check out hackosphere's updates

Any questions regarding these hacks are welcome and anyone familiar with these are welcome to help, thanks!


Bookmark and Share


5 comments:

Dexter : Techathand.net said...

I just link to this post

http://techathand.net/2008/01/link-love-9-seo-buzz-blogging-windows-tools-wordpress-blogspot-tips/

David Chen said...

Appreciate you stop by Dexter! Hope that this little tutorial help out some bloggers, thanks for letting me know!

Take Care

Naresh said...

Thanks a lot for your help.. I saw this on several websites and it didnt work. Your blog helped me a lot. I implemented the solution in my blog at

http://nareshit.blogspot.com

body fitness said...

Good Day !
i only foundnd in my code "data:label.url" only? but theres no + "?max-results=30" i found in my code?
i expanded widget already. Whats the prob? can you help me?

Thanks.

David said...

@body fitness,
Hello there, sorry for the late reply, here is the deal.

You are suppose to find "data:label.url" inside your expanded blogger code. Now, with "?max-results=" concatenates after "data:label.url", you tell blogger that you like this many maximum of posts to show with that label. So it shouldn't be there initial, you have to add "?max-results=" yourself and with number of posts you like per page, lets say 40 posts, I would add 40 after "?max-results=" so the code would be like "data:label.url?max-results=40". I hope that you understand the purpose and how to use it. Thanks for stopping by and hope it works out! :)