The gadget is really great, but I missed some features. If you have always the same list in the same order in your sidebar, users very quickly ignore it. But if you shuffle the entries, the list looks fresh every page load. And I could not tell, which one of my most popular posts is the best, they are all good ;) and so random order suits them better.
So my first hack (more coming along) for the Popular Posts gadget randomizes the order of the popular posts. You can install this by adding extra HTML/Javascript gadget in your sidebar or paste the code to an existing gadget (the gadget must be after the popular posts gadget!), or you can put this code in your template html, just before </body>.
I use a simple but effective Fisher-Yates/Knuth shuffle to shuffle the posts. You must have jQuery loaded in your page for the code to work. If the script did nothing to your popular posts list, try adding the following code, which loads jQuery, in your template before </head>:
<script src='http://code.jquery.com/jquery-latest.js' type='text/javascript'></script>I'm very pleased with the result of the hack, and hope you like it, too. You can see a working example of this in my MS-potilas blog ("Popular Posts" is "Suositut artikkelit" in Finnish), and later I'll install this also on YABTB (now installed).
Click on a single comment to hide/show its text
7 comments:
THANK YOU IT WORKS
by the way do you know the blogger popular post html code
i want to put it on post page but blogger only allows widgets without giving you the code
chers
@kawsar
At this point it is not possible to display popular posts in any other way than using the widget. There has been a feature request here to expose the popular posts as a feed.
@JeLBee Hub
No, that's not possible. Popular posts cannot be fetched from feed, and Blogger feeds cannot be ordered randomly (but javascript can randomize the order of the results). It would be great to have the popular posts feed, with more than 10 entries. Maybe some day. :)
Hi, thanks for the hacks on popular posts!
I am looking for a way to display popular posts by label (category), so in each label (or category), there is a unique list of popular posts only for this label (or category).
Did you try this?
Hope you can share this if you success, thanks in advance!
@Michael G
Hi, I'm afraid it is not possible, or at least I don't know how to do it. My hacks only handles posts the popular posts gadget outputs. Currently the gadget does not support fetching popular posts by given label, and there is no other way to retrieve lists of popular posts in blogger.
I've tried using this on my blog several times and it didn't work. I finally found out why. Blogger has changed the div classes up a bit. You need to edit the code above to show .Popular-Posts instead of .popular-posts in the JavaScript and it will work. Thanks for the hack here.
See the hack to make the 'Post a Comment' link bigger.
Post a Comment