Star ratings is a new feature currently available through Blogger in Draft. This enables you to add a widget beneath your posts which readers can use to rate your articles on a scale of 1-5, like this:If you use a default Blogger template, you should be able to activate this feature right away when logged through Blogger in Draft: simply go to Layout>Page Elements and edit the "Blog Posts" widget to activate the display.
However, those using a customized or third party template will need to add the required code to their templates first. In this tutorial, I'll explain how you can add "star-rating" functionality to your customized Blogger template.
To use the "star ratings" feature, you will first need to activate this through Blogger in Draft (it's still in beta, and not yet available for use in the regular Blogger dashboard).
Log into Blogger in Draft and choose the blog you wish to work with. Then go to Layout>Page Elements, and click the "Edit" link on the "Blog posts" widget.
This screen offers many options for you to add (or remove) from the posts section of your blog. If you scroll down a little, you'll see the "star ratings" option. Tick this option to activate this setting for your blog, then scroll down to save your settings.
If you are using a default template, you should see the star ratings widget appear on the post pages of your blog. However, if you have customized your template (or are using a third party template), it is likely that your template does not include the code required to make the star ratings display.
Here is how you can add the required code for star ratings to your non-standard Blogger template
- Go to the Edit HTML page in your blog's dashboard, and ensure you have checked the "expand widget templates" box.
- Using your browser's search function, try to find this line of code:
<div class='post-footer-line post-footer-line-1'>
If you cannot locate this, search for the following instead:
<p><data:post.body /></p>
- Immediately after this line (either the post-footer or post.body), add the following section of code:
<b:if cond='data:blog.pageType == "item"'>
<span class='star-ratings'>
<b:if cond='data:top.showStars'>
<div expr:g:background-color='data:backgroundColor' expr:g:text-color='data:textColor' expr:g:url='data:post.absoluteUrl' g:height='42' g:type='RatingPanel' g:width='180'/>
</b:if>
</span>
</b:if> - Next, find this line in your Blogger template (this should be a little further down):
<b:include name='nextprev'/>
- Just after this line, paste the following section of code:
<b:if cond='data:top.showStars'>
<script src='http://www.google.com/jsapi' type='text/javascript'/>
<script type='text/javascript'>
google.load("annotations", "1");
function initialize() {
google.annotations.createAll();
google.annotations.fetch();
}
google.setOnLoadCallback(initialize);
</script>
</b:if> - Then save your template.
Now when you view a post page on your blog, you should see the star ratings appear beneath your posts!
Anurag Bansal has posted a similar tutorial on his blog, Knowliz. If you have any problems with this version, I'd advise you to check out this page instead (thanks for the comment and info, Anurag!).
If you would prefer the star ratings to appear on all pages of your blog, you can remove the lines which include the <b:if> tags. These lines tell Blogger to display the star ratings only on your post pages; removing them enables them to be displayed on all pages of your blog (take a look at this post for more information about the b:if function).
I hope this tutorial will help you understand how to apply the star-ratings function on your Blogger powered blogs! Please let me know what you think about this post by leaving your comments below.



80 Comments:
Hi Amanda,
In your previous post about Embedding Comment form, I left a comment with the link to my post explaining the same thing. Here is the link again:
http://www.knowliz.com/2008/07/how-to-add-star-rating-to-custom.html
Thanks for providing the information to a wider audience you have.
Doesn't work for me :(
Thanks for posting this info! I use the blogger template and had no problem figuring out how to turn on this feature, (with your help of course!)
Doesnt work for my blogger either, I wont even bother to ask you anything, last time I left a comment here about the in-line comment you didnt answer me.
If it wanst for this other guy that followed my comment and went to my blog, I would still be helpless.
Thanx for nothing!
Doesn't work for me!
Thank you the post.
Worth a try.
It does not work for me too.
http://vietblogviet.blogspot.com
It does not work for me. I ticked "star ratings" option and saw no change to my blog. I then changed the code for star ratings and again nothing happened.
I'm truly sorry for the problems some of you have experienced using this method. When I reviewed my method, I realized that I'd forgotten to add an important section of code to the tutorial!
The post is now updated to include all necessary code. I've just tried this out in three different customized templates to ensure it works as planned.
Hope this update will help solve the problems and enable you all to display the star ratings :)
it worked for my blog but it appears twice.
Thanks Amanda,
Great stuff as always and working fine on my test blogs.
It works now but the color does not match with background, how can I do it now? Thanks
Hi! Hi have the same problem as tran tinh! Any help? Thanks!
If this help:
I noticed that star rating uses the bgcolor/mainbgcolor variables. But my template don't have any variables section! I don't know why!!!
How can I change it?!?
Thanks ;)
Use this sort of code <div g:background-color='#ffffff' g:text-color='#ffffff' expr:g:url='data:post.absoluteUrl' g:height='42' g:type='RatingPanel' g:width='180'/> instead of
<div expr:g:background-color='data:backgroundColor' expr:g:text-color='data:textColor' expr:g:url='data:post.absoluteUrl' g:height='42' g:type='RatingPanel' g:width='180'/>
You should replace #ffffff with appropriate color codes..
Hi Amanda, thanks for that its great.
I am trying to remove the bif lines so i can see the star rating on any post or page. However when i remove them i get the message the div needs to be closed properly but i cant see where. Any suggestions anyone? Thanks
Thank u so much
i also facing the same problem like crissy, it appears twice!
Thank you sooo much Aneesh!!! I solved the problem!
Dear Amanda, I think you should add this tip too in this tutorial!!
Thanks again for the support...
I got the double too, but if you go back into the html and make sure there is only one copy it works.
I think this is a great ways to know our popular pages by checking it star. Thanks for tips.
Oh... Now I have another problem! Whwn I put that code i get like a white box around the star rating, i tried to decrease the size the size in "g:height='42' g:type='RatingPanel' g:width='180'/>", but when it's good in firefox it's wrong in IE!! Any help?
Thanks
Thanks Amanda for including my blog link.
After reading couple of comments above, I realized lot of user are experiencing background color issue which is white by default.
If any of you want to sort out that issue, drop at my blog and leave a comment on any post or the post Amanda mentioned above, I would be very happy to help.
Generally people with custom background URLs are facing this issue.
Thanks
Anurag Bansal
I wonder if Google intends to use these star ratings in their Search Engine rankings? I would hazard a guess that they will - it makes perfect sense, so long as people don't exploit them.
WOW... Horay! I managed to install Comment Box and Star Rating. Thanks to you bro! Success
wanna see: http://freeinternetmarketingresources.com
Sorry... not bro but Sis :)
I didn't noticed till I saw the author.
Looking forward your hundred tips to blogging world since I'm newbie.
ASk your permission to put your link on my blog to this useful article and some other articles that can benefit my blog reader in the future???
Success
Still doesn't work on mine
Sorry Amanda, doesn't work in mine either. I've always had success with your tutorials also, so I know I've done everything correct. Will keep trying though!
I followed your instructions and checked the other posts mentioned, but unfortunately Blogger replies with: bX-vxhwro...
Thanks for your time and effort, but it seems to be that Google will need again some years to let this function.
Following Amanda's instructions I managed to get the star ratings working on all of my blogs:
http://www.growlingdoggames.com
http://www.thebeginnersbloggingguide.com
http://www.theparanormalblogsite.com
You can see them in the post pages only.
I would suggest that the reason some people are having problems is because they aren't going into Blogger Draft and enabling the star ratings in the Blogger Draft post layouts page...
Just a guess, otherwise I can't see why it wouldn't work.
Thanks Amanda.
This post help me more.
So I translated this post into Korean as 별 등급 보기 Star Ratings.
Thanks to Anurag Bansal my star rating is fully working! You can see it in www.loltuga.info!
Zizukabi:
Sorry man, but I just thought what you said was very funny. :p
i am able to add the star rating but , it is appearing above the post and below the post title.........how to place it below the post
i use template by blogger buster......
www.sarv007.blogspot.com
how can find the codesearching in my brownser
Worked after I manually added the lines of code. Checking the box didn't work for some reason. Thanks Amanda!
I finally got mine to work, but like the many others here and at Knowliz's site, I am also having problems with the background color. It's fine if you have a white background, but mine is black. So I found this great rating code at http://js-kit.com/ ,it's perfect, it was extremely easy to install and runs great. It also ties into other products they have, check out the site, you can see the ratings in action on my site www.jeannettejayhawksfootball.blogspot.com
Amanda, I mean no harmful intentions here, and am most certainly not trying to drive people away from your fantastic work here. But this other method was way easier to install, and looks great! Blends in with my site colors.
For anyone having problems, take a look at JS-Kit
worked for me but it appears twice at the bottom of my posts - any ideas why this would be happening?
Hey Amanda I cant see my stars. I tried it but they didnt come up. I might try it again but well.
resolved it by following the steps here (as advised above): http://www.knowliz.com/2008/07/how-to-add-star-rating-to-custom.html
I have already figured out the problem. Thanks for your tutorial Amanda. Your blog really helped me a lot! More power!
Does this work for classic template.. i do not have widgets.
Isn't it fascinating? I have been browsing your blog all day to put some flicks in my blog. Thank you for your genius mind that we can beautify our blogs.
Help me!!!!!!!!
I couldnot find any of the code u've told to search for in my template....
http://cooltechwares.blogspot.com
Another alternative for bloggers needing rating widgets :
Please check out our rating widget service at http://www.yellowturnip.com/blogger.html
You can customize colors/size of the stars,prevent duplicate rating, identify the city location of the raters and list the top rated blogposts in the sidebar of your blog.
No login/registration required.
if this doesn't work, try this: http://gosublogger.com/2008/07/adding-star-rating-to-custom-blogger-templates/
it works for me
hi
i found a simple step to add star ratings,means u must acces outbrain.com and all is nice..no html cod,only user and password...im from romania and my blog is www.reduceri-imbracaminte.blogspot.com..u can see my stars in my blog:)) bye and thanks AMANDA FOR YOUR SUPPORT OF BLOGGERS
doesnt work
Hi,
I had the same problem described by Radio F.C. and I solved it following the knowliz tutorial but I would like to change the font-style.. anyone can help me?
http://iphoneruler.blogspot.com
Thank you! The star ratings showed up twice initially, but I just had to remove similar code just a few lines down from 'step 4.' Works fine now :)
Hi. I can't seem to follow instructions. I got stuck at the "edit blog post widget." Thanks.
pola oznaczone gwiazdką muszą zostać wypełnione
http://florida-id-templat.solik.osa.pl
Hello Amanda, happy new year btw, I have one question regarding the ratings code is it possible to add some div style or something in the CSS to change the background & the text colours?
Hey Amanda,
Love the site! It's awesome! Anyways, me and some friends run a book reviews site over at www.teencbr.blogspot.com. I use your awesome elegumus template. When I selected the star ratings, it worked but the background doesn't match the post background. Help?
U
Thanks Amanda! ^^
Customizing the bg and text color of this widget is far easier than you think. Read here: http://www.looblog.info/2009/01/customizing-star-rating-widget-for.html
Wola, nice share Amanda. Thanks
Thanks!
nice blog! 5*
thank bro for your info, i'll try it first
http://time24get.blogspot.com
not working for me also
Is it posible to make Star ratings work with IE8
thanks....let's try!!!
shown nothing on mine please help.
http://rapidlord.blogspot.com and http://hangmeasrapid.blogspot.com
thank i will try it. i think it work.
Thank you very much, it works after I follow your instructions but now it displays twice, how do I remove the extra one? Thanks again
with draft.blogger.com somehow when clicking to post a comment, not able to do so. HELP!!! please. Thanks.
ouch.. the code does not work on my blog..
I add, but its not working, what should i do now?
It does not work for me too.
sorry, it didnt work
It worked for me. At first it showed two ratings. I fixed it by only putting the first chunk of code.
Oh, It didn't work with me !
I can't find the tags you wrote above in my tamplete.
When I use draft blogger to add the stars, they don't appear.
When I try to add your code, I can't figure out where to put it in my html. I tried locating the lines of code that you referred to, but they don't seem to exist.
Any suggestions? Thanks!
dude its not working for me, i cant see the star ratings in my blog,pls help me........just visit my blog http://tvlganesh.blogspot.com....
Thank you very much, it works after I follow your instructions but now it displays twice
Post a Comment