自定义 Google +1 文本和图像

发布于 2024-11-18 22:28:20 字数 204 浏览 7 评论 0原文

有谁知道如何更改您的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

绮烟 2024-11-25 22:28:20

好的。闲来无事之后 - 很多很多链接到我的个人资料......

这就是你如何做到这一点。 (我指的“帖子”是您在 google + 上的个人资料 +1 页面中的条目,“目标页面”是您使用 +1 按钮标签引用的页面。)

  1. 目标上帖子的标题页面是作为帖子标题读取的内容。
  2. 帖子的内容是从目标页面上的第一个文本块中提取的。
  3. 帖子的图像(如拇指所示)是页面上找到的第一个图像
  4. 。站点名称(蓝色)是页面的域。

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. )

  1. The title of the post on the target page is what gets read as the title for the post.
  2. The content of the post is pulled from the first block of text on your target page
  3. The image of the post ( as in the thumb ) is the first image found on the page
  4. The site name (in blue) is the domain of your page.

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.

ゃ人海孤独症 2024-11-25 22:28:20

最好的方法是使用 Schema.org 微数据格式,您可以从 中看到此示例来自 Google 文档:

<body itemscope itemtype="http://schema.org/Product">
  <h1 itemprop="name">Shiny Trinket</h1>
  <img itemprop="image" src="{image-url}" />
  <p itemprop="description">Shiny trinkets are shiny.</p>
</body>

详细信息:

  • 将这些属性添加到您的正文中:

    
    
  • 要使用的页面标题:

    闪亮饰品

    ;
  • 要使用的图像:

    >
    
  • 要使用的说明:

    闪亮的小饰品很闪亮。

The best way is to use the Schema.org microdata format, as you can see from this example from Google documentation:

<body itemscope itemtype="http://schema.org/Product">
  <h1 itemprop="name">Shiny Trinket</h1>
  <img itemprop="image" src="{image-url}" />
  <p itemprop="description">Shiny trinkets are shiny.</p>
</body>

In detail:

  • Add these attributes to your body:

    <body itemscope itemtype="http://schema.org/Product">
    
  • Title of the page to use:

    <h1 itemprop="name">Shiny Trinket</h1>
    
  • Image to use:

    <img itemprop="image" src="{image-url}" />
    
  • Description to use:

    <p itemprop="description">Shiny trinkets are shiny.</p>
    
难忘№最初的完美 2024-11-25 22:28:20

你检查过谷歌的文档吗? http://code.google.com/apis/+1button/

Have you checked out Google's docs? http://code.google.com/apis/+1button/

童话里做英雄 2024-11-25 22:28:20

您可以通过将其不透明度设置为“0”来做到这一点。

我已经成功做到了。

You can do it by setting it's opacity to "0"..

I've successfully done that..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文