Is including <meta name="fragment" content="!"> harmful for pages with hashbang?
Asked Answered
S

2

27

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?

Singband answered 18/6, 2013 at 20:38 Comment(1)
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.Singband
L
9

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!

Lemmie answered 19/6, 2013 at 12:13 Comment(5)
That's exactly what I've been thinking, too. It's just the wording in this Google paper that scares me a bit: developers.google.com/webmasters/ajax-crawling/docs/… "The meta tag may only appear in pages without hash fragments"Singband
Okay, this sentence is a little bit confusing. But as a proof of concept I may provide the following link: google.com/search?q=site:emanuel.kodingen.com/wordpress These are the crawling results for the demo-page of my Backboned-wordpress-theme. All pages contain the hashbang and the meta-tag. Nevertheless they are fully indexed. Maybe the sentence is a bit ambiguous and they actually wanted to say, that you may not use the common hash fragment (www.domain.com#foo) accompanied by the meta-tag!?! o_OLemmie
And this is all now deprecated? googlewebmastercentral.blogspot.jp/2015/10/…Dichlorodiphenyltrichloroethane
Yep, Google is able to have its crawler run JS now. No need for fallback-content anymore.Lemmie
Can you please update the answer ... the tag was supposed to go after the summer of 2018 and its Christmas already...Thanks :)Milinda
K
4

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="!"

Kamila answered 1/5, 2014 at 8:34 Comment(2)
Ahh - so maybe here is my mistake. Does this mean, when the google crawler asks for "domain/path?_escaped_frament_=" the meta-tag must be removed? Because i'm using the technique with the "meta-tag" but it is not working. The crawler just crawls the normal version (so not the html snapshot).Mantling
seems deprecatedGalsworthy

© 2022 - 2024 — McMap. All rights reserved.