我有一个 angular.js 应用程序。我已经遵循了基于 ajax 的应用程序的谷歌指南。我已经这样做了:
- 元标记
<base href="/">
<meta name="fragment" content="!">
- angular.js 配置
$locationProvider.html5Mode(true);
$locationProvider.hashPrefix('!');
- 我的 html 链接看起来像这样(有错吗?):
<a ng-href="/#!/login">Login</a>
- 我将站点地图提交到谷歌搜索控制台(x 个月前)
我发现我不应该使用 escaped_fragment,对吗?难道我做错了什么?它仍然没有索引。 Google 仅索引主页。
当我运行 fetch as google 工具时,它会正确呈现所有页面。
最佳答案
I found that I should not use escaped_fragment, is it correct?
这是正确的,截至目前 official announcement .
还引入了额外的最佳实践:
For optimal rendering and indexing, our new guideline specifies that you should allow Googlebot access to the JavaScript, CSS, and image files that your pages use. This provides you optimal rendering and indexing for your site. Disallowing crawling of Javascript or CSS files in your site’s robots.txt directly harms how well our algorithms render and index your content and can result in suboptimal rankings.
取自Official Google Webmasters Blog
那么,您是否允许 Googlebot 访问所有必要的文件?
您的网址是什么样的?是否也可以作为静态 HTML 访问?在 Google 的公告中,他们仍然推荐渐进式增强 的概念,因此在您的情况下也提供静态文件可能会有所帮助。
关于javascript - angular.js 如何告诉谷歌索引我的网站?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35311646/