我有这段代码
<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>
我在变量url
中有一个网址:
url = "http://www.mydomain.com/my_custom_url"
我想添加这个google plus按钮这个url变量。
我该怎么做?
非常感谢!
答案 0 :(得分:1)
我设法找到了developer docs。这有点令人困惑,但您只需将URL作为<g:plusone>
标记的href属性。例如:
<g:plusone size="medium" annotation="none" href="the url!"></g:plusone>