<% c...">

Specify custom url for gplus one button

I have this code

<div class="google_button"> <g:plusone size="medium" annotation="none"></g:plusone> <% case I18n.locale.to_s %> <% when 'en' %> <script type="text/javascript"> (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })(); </script> <% when 'es'%> <script type="text/javascript"> window.___gcfg = {lang: 'es'}; (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })(); </script> <% end %> </div> 

I have a url url variable:

 url = "http://www.mydomain.com/my_custom_url" 

I want to add this google plus button to this URL variable.

How can i do this?

Many thanks!

0
source share
1 answer

I managed to find developer documents . This is a bit confusing, but you just need to specify the URL as the href attribute of the <g:plusone> . For example:

 <g:plusone size="medium" annotation="none" href="the url!"></g:plusone> 
+1
source

All Articles