Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Can I make a Google +1 button +1 a specific URL - e.g. my front page, http://www.givingwhatwecan.org/ - rather than the URL the button's on? I've read that you can do this by putting that URL between the g:plusone tags like so:

<g:plusone>http://www.givingwhatwecan.org/</g:plusone>

However I've done this on both http://gwwc2.centreforeffectivealtruism.org/ & http://gwwc2.centreforeffectivealtruism.org/resources/index.php and it only seems to work on the former - if you click the +1 button on the latter, you'll be +1ing http://gwwc2.centreforeffectivealtruism.org/resources/index.php rather than http://www.givingwhatwecan.org/

share|improve this question
add comment

1 Answer

up vote 8 down vote accepted

Your code snippet does not match the one over at NicheProfit. (Though it does match the description, which is inaccurate.)

The custom URL is added as an href attribute on the g:plusone element:

<g:plusone href="http://www.example.com/"></g:plusone>

Alternately, just use Google's code generator, pop open the Advanced Options toggle, and fill out the "URL to +1:" field.

And here's the actual documentation on setting a target URL.

Disregard your two examples behaving differently. They're just wrong in the first place, so not worth debugging.

share|improve this answer
    
Thanks, I was going on NicheProfit's description –  tog22 May 18 '12 at 5:57
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.