简体   繁体   English

angular.js如何告诉谷歌索引我的网站?

[英]angular.js how to tell google to index my site?

I've an angular.js app. 我有一个angular.js应用程序。 I have followed google's guide for ajax based applications. 我已经关注了基于ajax的应用程序的谷歌指南。 I've done this: 我这样做了:

  1. meta tags 元标记

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

  1. angular.js config angular.js配置

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

  1. my html links looks like this(is it wrong?): 我的HTML链接看起来像这样(是不是错了?):

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

  1. I submitted sitemap into google search console (x months ago) 我将站点地图提交到谷歌搜索控制台(x个月前)

I found that I should not use escaped_fragment, is it correct? 我发现我不应该使用escaped_fragment,这是正确的吗? Am I doing something wrong? 难道我做错了什么? It's still not indexing. 它仍然没有索引。 Google indexed just homepage. Google将主页编入索引。

When I run fetch as google tool it renders all pages correctly. 当我以谷歌工具的形式运行fetch时,它会正确呈现所有页面。

我们在相当长的一段时间内遇到了同样的问题,并且在决定使用服务prerender.io之后,使用app静态缓存并为谷歌和其他搜索抓取工具提供此内容。

I found that I should not use escaped_fragment, is it correct? 我发现我不应该使用escaped_fragment,这是正确的吗?

This is correct, as of this official announcement . 这是正确的,截至本官方公告


Also there was additional best-practice introduced: 还有其他最佳实践介绍:

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. 为了获得最佳呈现和索引,我们的新指南指定您应允许Googlebot访问您的网页使用的JavaScript,CSS和图像文件。 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. 禁止在您网站的robots.txt中抓取Javascript或CSS文件直接损害我们的算法渲染和索引您的内容的效果,并可能导致次优排名。

Taken from the Official Google Webmasters Blog 摘自Google官方网站管理员博客


So, are you allowing Googlebot access to all necessary files? 那么,您是否允许Googlebot访问所有必需的文件?

And how do your URLs look like? 你的网址是怎样的? Are there also accessible as static HTML? 是否也可以作为静态HTML访问? As of the announcements of Google they still recommend the concept of Progressive enhancement , so it might be beneficial in your case to also serve static files. 截至谷歌的公告,他们仍然推荐渐进增强的概念,因此在您的情况下也可以提供静态文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM