5

我目前正在使用 Angular 开发一个社交应用程序。我希望有公共的、搜索引擎可索引的页面来伴随应用程序,例如可索引的主页、关于页面和联系页面。

解决此问题的最佳方法是什么?我不确定我的后端基础架构将是什么,但它要么是以下之一:

  1. nginx/apache 服务器通过外部 pub/sub 服务实时出售所有内容。
  2. 前端和后端的单独服务 - nginx 服务器出售前端内容。用于后端套接字内容的单独节点服务器。

对此的任何建议都会很棒。我很想知道角度是否处理所有路由,或者我是否单独处理静态路由。这是我第一次玩 Angular。

干杯。

4

1 回答 1

3

I might be wrong but I think your problem is not an AngularJS one, it's more fundamental than that.

Your issue is one where you are loading HTML content via AJAX. And how does Google etc. crawl AJAX loaded content if it can't execute JavaScript?

This might help: https://developers.google.com/webmasters/ajax-crawling/

This might help too but its geared towards .NET: http://gregorypratt.github.com/Ajax-Crawling/

If you provide a solution where you let AngularJS do the routing but you still are able to serve static content from the server when ?_escaped_fragment_= is present in the URL then you're good to go. You get single page app benefits whilst still being crawlable.

The following is an example site using AngularJS routing and static content being served for Google et al.

http://artelier.co.uk/#!/about

http://artelier.co.uk/?_escaped_fragment_=/about (turn off JS to see it work)

于 2013-04-04T13:50:13.733 回答