can I force Google+ button to use open graph URL?

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-24 07:29:01

问题


Is it possible to make Google Plus use open graph URL? I already use OG for Facebook, so have this in code:

<meta property="og:url" content="http://www.sandrophoto.com/category/famous-photographers/"/>
<meta property="og:type" content="website" />

But Google doesn't want to respect it! Any thoughts?


回答1:


Google Plus 1 doesn't currently support og tags. The URL that is +1'd is determined by one of three things, in this order:

  1. The button's href attribute This attribute explicitly defines the +1 target URL.
  2. The page's <link rel="canonical" ... /> tag If the +1 button's href attribute is not provided, Google will use the page's canonical URL. For more information on defining the canonical URL for a page, see http://www.google.com/support/webmasters/bin/answer.py?answer=139066.
  3. The URL provided by document.location.href (not recommended) If neither of these pieces of data are present, Google will use the URL of the page as found in the DOM. Because this URL might contain session IDs, anchors, or other parameters that are not actually part of the canonical URL, we highly recommend either setting the href attribute for the +1 button or adding a <link rel="canonical" ...> tag to your page.



回答2:


Just in case it isn't too obvious from DMC's accepted answer: it's not that Google doesn't support Opengraph. They don't use OG's url property, but they will use other properties (specifically title, image and description as mentioned by Sandro's comment). But they do prefer Schema.org microdata over Opengraph:

Populating the +Snippet

After +1'ing a page, the user is given the option to share the page to Google+ via a displayed Share bubble. This share bubble (along with the resulting Google+ activity post) includes a preview, or +Snippet, that contains the page title, a brief description of the page, and a thumbnail image. These pieces of data are extracted from the target URL's content in one of four ways, listed in order of precedence:

  1. Schema.org microdata (recommended)
  2. Open Graph protocol
  3. Meta "title" and "description" tags
  4. Best guess from page content (not recommended)

https://developers.google.com/+/plugins/+1button/#plus-snippet




回答3:


You can specify any link you like within the button code

When Google crawl the page if the URL specified is dfferent to the canonical of the page, they will apply the button count to the canonical URL

I don't think the canonical support with the count in this way has ever been announced - I only discovered it by setting up a test and checking it periodically. http://andybeard.eu/3618/google-plus-canonical.html

This allows you to use special tracking links, shortlinks etc for the link which is +1ed



来源:https://stackoverflow.com/questions/8861651/can-i-force-google-button-to-use-open-graph-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!