Angular 路由器和动态链接如何与 Google 服务一起使用?

How does Angular router and dynamic links work with Google services?

我正处于一个涉及管理/前端的项目的末尾 angularjs。在这个项目中有一个博客和一个 space 项目 post。

我对 angular 创建的链接有一些疑问,因为它们是动态的:

我没有看到另一个地方可以 post 消除我的疑虑,因为我知道 Whosebug 只有 angular 野兽中的人。

.state('home.posts',{
    url         : '/blog/:slug',
    templateUrl : 'content/templates/single.html',
    theme       : 'indigo',
    controller: function(ApiRestangular, $stateParams, $scope){
        ApiRestangular.all('posts').getList({filter: {slug: $stateParams.slug}}).then(function(res){
            $scope.item = res[0];
        });
    },
    data: {
        pageTitle: 'title'
    },
    access: {
        requiredLogin: false
    }
})

由于您的内容基本上会在执行 AJAX 请求后呈现,因此 Google 无法抓取这些页面。如果您希望发生这种情况,我建议您看一下 Prerender.io

The Google indexes those links? If not, is there any way?

Google 无法索引此 link。您可以使用 http://phantomjs.org/ to generate static pages. Read this article for details http://www.ng-newsletter.com/posts/serious-angular-seo.html

The links created by the angular, can I use Google Analytics to access their statistics?

是的,你可以。您可以使用 Angulartics https://luisfarzati.github.io/angulartics/ 或编写您自己的服务或指令,它会根据您的规则将事件发送到 google 分析。