【问题标题】:AngularJS and Google Ajax CrawlerAngularJS 和 Google Ajax 爬虫
【发布时间】:2013-03-28 03:44:20
【问题描述】:

所以基本上我试图让 angularJs 路由看起来像这样

 www.example.com/ajax.html#!product=1234

而不是这样

www.example.com/ajax.html#/product/1234

还有希望吗?

【问题讨论】:

    标签: ajax seo angularjs


    【解决方案1】:

    您只需配置$location service 并调用:

    $locationProvider.hashPrefix("!")
    

    【讨论】:

    • 这里有一些关于它的小讨论,尽管groups.google.com/forum/?fromgroups=#!topic/angular/pMEvWSR8ffA
    • google说你不需要了,你只需要在locationprovider中开启html推送状态并在head中添加
    • @calmbird 它不会阻止使用 #!如果您愿意,而不是 pushState API。顺便说一句,正确配置 HTTP 服务器以使用 #!网址要容易得多。
    【解决方案2】:

    如果您运行 ruby​​ 应用程序并希望遵守 google ajax 抓取方案 - 有一个 gem 可以为任何机架应用程序实现抓取方案......

    gem install google_ajax_crawler
    

    如何使用它的文章在http://thecodeabode.blogspot.com.au/2013/03/backbonejs-and-seo-google-ajax-crawling.html,源代码在https://github.com/benkitzelman/google-ajax-crawler

    【讨论】:

    • 不幸的是,它是作为机架中间件运行的 ruby​​ gem,所以只有那些运行 ruby​​ 机架后端(即 rails / sinatra)的 ajax 重度应用程序
    猜你喜欢
    • 1970-01-01
    • 2013-02-08
    • 2019-11-07
    • 1970-01-01
    • 2012-06-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多