angular.js 如何告诉 google 将我的网站编入索引?

angular.js how to tell google to index my site?

我有一个 angular.js 应用程序。我已遵循 google 的基于 ajax 的应用程序指南。我已经这样做了:

  1. 元标签

<base href="/"> <meta name="fragment" content="!">

  1. angular.js 配置

$locationProvider.html5Mode(true); $locationProvider.hashPrefix('!');

  1. 我的 html 链接看起来像这样(有错吗?):

<a ng-href="/#!/login">Login</a>

  1. 我将站点地图提交到 google 搜索控制台(x 个月前)

我发现我不应该使用escaped_fragment,对吗?难道我做错了什么?它仍然没有索引。 Google 仅索引主页。

当我 运行 作为 google 工具获取时,它会正确呈现所有页面。

我们为同一个问题苦苦挣扎了很长一段时间,然后决定使用服务 prerender.io 为您的应用程序制作静态缓存,并为 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 的公告中,他们仍然推荐 渐进增强 的概念,因此在您的情况下也提供静态文件可能是有益的。