包括 <meta name="fragment"内容=“!">对带有 hashbang 的页面有害吗? [英] Is including &lt;meta name=&quot;fragment&quot; content=&quot;!&quot;&gt; harmful for pages with hashbang?

查看:92
本文介绍了包括 <meta name="fragment"内容=“!">对带有 hashbang 的页面有害吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google 关于此元标记的说明:

Google says about this meta tag:

以下重要限制适用:

  1. 元标记只能出现在没有散列片段的页面中.
  2. 只有!"可能会出现在内容字段中.
  3. 元标记必须出现在文档的头部.

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

我知道只有那些包含 hashbang 但仍应提供快照的页面才需要它.但这通常只是主页.

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.

假设我们有:

www.foo.com

www.foo.com/#!/jobs

第二个将被提取为:

www.foo.com?_escaped_fragment_=/jobs

www.foo.com?_escaped_fragment_=/jobs

只是因为哈希爆炸.

但是根页面没有hashbang,所以它需要在头部有这个特殊的元标记.

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

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

但是由于我所有的单页应用程序都使用相同的 <head> 到目前为止,我想知道为所有其他做的页面保留元标记是否真的有害strong> 包含一个 hashbang.

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.

实际会发生什么?

推荐答案

它不只是一个 Opt-In,意味着在包含 hashbangs 的页面上使用它是多余的(无害的)吗?!根据我的理解,爬虫会自动查找 _escaped_fragment_-page,如果它在 URI 中检测到 hashbang.只有当 URI 中没有 hashbang 时,您才可以建议爬虫使用元标记附加 _escaped_fragment_-parameter.这样,如果设置了参数,您就可以提供不同的内容.这就是一些 blogspot 主题的工作方式(例如 http://illegalcartoon.blogspot.de/).

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

我问对了吗?

Google 已弃用使用 _escaped_fragment_ 的 AJAX 抓取方案.以下是相关博文的引述:

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

今天,只要您不阻止 Googlebot 抓取您的 JavaScript 或 CSS 文件,我们通常就能像现代浏览器一样呈现和理解您的网页.

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.

在此处阅读完整文章:https:///webmasters.googleblog.com/2015/10/deprecating-our-ajax-crawling-scheme.html

这篇关于包括 <meta name="fragment"内容=“!">对带有 hashbang 的页面有害吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆