26
votes

Google says about this meta tag:

The following important restrictions apply:

  1. The meta tag may only appear in pages without hash fragments.
  2. Only "!" may appear in the content field.
  3. The meta tag must appear in the head of the document.

Source: https://developers.google.com/webmasters/ajax-crawling/docs/specification?hl=fr-FR

I'm aware that it is only needed for pages that do not contain a hashbang but still should be served with a snapshot. But that is usually just the home page.

Let's say we have:

www.foo.com

www.foo.com/#!/jobs

The second one will be fetched as:

www.foo.com?_escaped_fragment_=/jobs

just because of the hashbang.

But the root page has no hashbang so it needs to have this special meta tag in the head.

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

But since all my single page application uses the same <head> so far I wonder if it's actually harmful to keep the meta tag in for all the other pages that do contain a hashbang.

What will actually happen?

2
Something is either wrong with me or with SO. I see a lot of questions closed recently that seem totally valid to me. Please at least provide more information on what is wrong with the question, when closing it.Christoph

2 Answers

8
votes

Isn't it just an Opt-In, meaning it's redundant (not harmful) to use it on pages containing hashbangs?! In my understanding the crawler looks automatically for the _escaped_fragment_-page, if it detects a hashbang in the URI. Only if there's no hashbang in the URI you could advise the crawler to append the _escaped_fragment_-parameter by using the meta-tag. That way you can serve different content if the parameter is set. That's the way some blogspot-themes are working (e. g. http://illegalcartoon.blogspot.de/).

Did I get your question right?

Update:

The AJAX crawling scheme using _escaped_fragment_ has been deprecated by Google. Here's a quote from the regarding blogpost:

Today, as long as you're not blocking Googlebot from crawling your JavaScript or CSS files, we are generally able to render and understand your web pages like modern browsers.

Read the complete article here: https://webmasters.googleblog.com/2015/10/deprecating-our-ajax-crawling-scheme.html

Tl;dr: Stop using this!

3
votes

Based on this explanation from google if the page will have <meta name="fragment" content="!">

In order to get pages without hash fragments indexed, you include a special meta tag in the head of the HTML of your page. Important: Make sure you use this solution only for pages that include Ajax content. Adding this to non-Ajax pages creates no benefit and puts extra load on your servers and Google's.

This tag indicates to the crawler that it should crawl the ugly version of this URL. As per the above agreement, the crawler will temporarily map the pretty URL to the corresponding ugly URL. In other words, if you place into the page www.example.com, the crawler will temporarily map this URL to www.example.com?_escaped_fragment_= and will request this from your server. Your server should then return the HTML snapshot corresponding to www.example.com.

So when a server will get a request like this www.example.com?_escaped_fragment_= you can give him back a Snapshot without name="fragment" content="!"