自定义 Google +1 文本和图像
有谁知道如何更改您的 Google 个人资料中显示的 Google +1 按钮的图像和文本?我有一个网站,我想在人们按下 +1 按钮时设置自定义文本和图像。如果您不知道,此信息会显示在您的 Google 个人资料中的“+1”下方。
简而言之,有没有办法让 Google +1 按钮的功能与类似 Facebook 的按钮相同,以设置单击它时显示在您的个人资料中的自定义文本和图像。
Does anyone know how to change the image and text from the Google +1 button that shows up in your Google profile? I have a website and I want to set custom text and image for when people press the +1 button. This info shows up in your Google profile under "+1" if you aren't aware.
In short, is there a way to have the Google +1 button function the same as a Facebook like button in regards to setting the custom text and image that shows up in your profile when you click it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
好的。闲来无事之后 - 很多很多链接到我的个人资料......
这就是你如何做到这一点。 (我指的“帖子”是您在 google + 上的个人资料 +1 页面中的条目,“目标页面”是您使用 +1 按钮标签引用的页面。)
1、在目标页面的正文中创建一个div,并将div的样式属性设置为:“position:absolute; top:-1000px; left:-1000px;”
接下来,让页面本身在其标题中包含您希望在帖子中使用的标题标签。无论如何,这自然是该页面应该被调用的名称。
然后,在您创建的 div 中包含要在帖子上显示为拇指的图像副本,不必费心在 img 标签上包含大小属性,谷歌会忽略它。似乎也忽略任何不是图片的东西(即,用 php 编写的调整大小脚本,将文件作为参数)。
最后,将帖子的内容/正文添加到图片后面的 div 中。我不知道你能有多少文字。
就是这样。好吧,它是谷歌的,所以它会不断发展,但这对我有用。
戴夫.
Ok. After much ado about nothing - many many links to my profile later....
here's how you do it. ( the "post" I refer to is the entry in your profile's +1 page on google +, the "target page" is the page that you are referring to with the +1 button tag. )
1st, create a in the body of your target page, and set the style attribute of the div to : "position:absolute; top:-1000px; left: -1000px;"
next, have the page itself include a title tag in its header that you want to have in the post. this would naturally be what the page should be called anyway.
then, include in the div you created a copy of the image you want to display as the thumb on the post, dont bother including size attribs on the img tag, google ignores it. also appears to ignore anything that isn't a picture ( ie; a resize script written in php that takes a file as a param ).
lastly, add the content/body text of the post into the div after the picture. I've no idea how much text you can have.
And thats it. Well, its google so it'll evolve, but thats whats working for me.
Dave.
最好的方法是使用 Schema.org 微数据格式,您可以从 中看到此示例来自 Google 文档:
详细信息:
将这些属性添加到您的正文中:
要使用的页面标题:
要使用的图像:
要使用的说明:
The best way is to use the Schema.org microdata format, as you can see from this example from Google documentation:
In detail:
Add these attributes to your body:
Title of the page to use:
Image to use:
Description to use:
你检查过谷歌的文档吗? http://code.google.com/apis/+1button/
Have you checked out Google's docs? http://code.google.com/apis/+1button/
您可以通过将其不透明度设置为“0”来做到这一点。
我已经成功做到了。
You can do it by setting it's opacity to "0"..
I've successfully done that..