문제

Site Setup

I have a fully client-side one page webapp that is dynamically updated and routed on the client side. I redirect any #! requests to a headless server that renders the request with javascript executed and returns the final html to the bot. The head of the site also contains:

<meta name="fragment" content="!">

Fetch as Google works

Using the Fetch as Google webmaster tool, in the Fetch Status page, I can see that the jQuery I used to update the og:title, og:image, and og:description was executed and the default values replaced. Everything looks good, and if I mouseover the URL, the screenshot is correct.

However, with the Google Plus button, no matter what values og:title, og:image, and og:description tags are updated to, the share pop-up always uses the default/initial values.

Attempted use

I call this after each time the site content is updated, rerouted, and og meta content updated.

gapi.plusone.render("plusone-div");

I was assuming that if this approach works for the Googlebot, it should also work for the +1 button. Is there a difference between the Googlebot and whatever is used by +1 to retrieve the site metadata?

edit: Passing a url containing the #! results in a 'site not found'

gapi.plusone.render("plusone-div", {"href" : 'http://www.site.com/#!city/Paris');
도움이 되었습니까?

해결책

The Google crawler does not render the snippet when the +1 button is rendered but rather when a user clicks the +1 button (or share button). What you should try is to determine what your server is sending to the Googlebot during this user initiated and asynchronous load by the Google crawler.

You can emulate this by using the following cURL command:

curl -A "Mozilla/5.0 (Windows NT 6.1; rv:6.0) Gecko/20110814 Firefox/6.0 Google (+https://developers.google.com/+/web/snippet/)" http://myurl.com/path/to/page

You can output that command to a file by adding -o testoutput.html to the command.

This will give you an idea of what the Google crawler sees when it encounters your page. The structured data testing tool can also give you hints.

What you'll likely see is that unless your doing your snippet preparation in a static file or on the server side is that you're likely not going to get the snippet that you desire.

If you can provide real URLs to test, I can probably provide more specific feedback.

다른 팁

Google+ fetch the pages using the _escaped_fragment_ query parameter but without the equal sign.

So, it would fetch http://www.site.com/?_escaped_fragment and NOT https://www.site.com?_escaped_fragment_=

Google Search crawler still using the fragment with the equal sign, this is just for Google plus crawler.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top