搜索引擎如何处理 AngularJS 应用程序? [英] How do search engines deal with AngularJS applications?

查看:31
本文介绍了搜索引擎如何处理 AngularJS 应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现 AngularJS 应用程序存在两个关于搜索引擎和 SEO 的问题:

1) 自定义标签会发生什么?搜索引擎是否会忽略这些标签中的全部内容?即假设我有

<h1>嘿,这个标题很重要</h1></自定义>

尽管

位于自定义标签内,但仍会被编入索引吗?


2) 有没有办法避免搜索引擎索引 {{}} 字面绑定?即

{{title}}

我知道我可以做类似的事情

但是如果我真的想让爬虫看到"标题怎么办?服务器端渲染是唯一的解决方案吗?

解决方案

2014 年 5 月更新

Google 抓取工具现在执行 javascript - 您可以使用 Google 网站管理员工具,以更好地了解 Google 如何呈现您的网站.

原始答案
如果您想针对搜索引擎优化您的应用程序,很遗憾没有办法为爬虫提供预渲染版本.您可以在此处详细了解 Google 对 ajax 和 javascript 密集型网站的建议.>

如果这是一个选项,我建议您阅读这篇文章,了解如何使用服务器端渲染为 Angular 做 SEO.

我不确定爬虫遇到自定义标签时会做什么.

I see two issues with AngularJS application regarding search engines and SEO:

1) What happens with custom tags? Do search engines ignore the whole content within those tags? i.e. suppose I have

<custom>
  <h1>Hey, this title is important</h1>
</custom>

would <h1> be indexed despite being inside custom tags?


2) Is there a way to avoid search engines of indexing {{}} binds literally? i.e.

<h2>{{title}}</h2>

I know I could do something like

<h2 ng-bind="title"></h2>

but what if I want to actually let the crawler "see" the title? Is server-side rendering the only solution?

解决方案

Update May 2014

Google crawlers now executes javascript - you can use the Google Webmaster Tools to better understand how your sites are rendered by Google.

Original answer
If you want to optimize your app for search engines there is unfortunately no way around serving a pre-rendered version to the crawler. You can read more about Google's recommendations for ajax and javascript-heavy sites here.

If this is an option I'd recommend reading this article about how to do SEO for Angular with server-side rendering.

I’m not sure what the crawler does when it encounters custom tags.

这篇关于搜索引擎如何处理 AngularJS 应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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