Marco Riesco
Marco Riesco

Reputation: 511

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

I am in the end of a project involving an admin / frontend angularjs. Within this project there is a blog and a space for project post.

I have some questions regarding the links created by the angular, because they are dynamic:

I did not see another place to have posted my doubts because I know that the stackoverflow only have people in angular beast.

.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
    }
})

Upvotes: 1

Views: 179

Answers (2)

DLevsha
DLevsha

Reputation: 136

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

Google can't index this link. You can use 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?

Yes, you can. You can use Angulartics https://luisfarzati.github.io/angulartics/ or write your own service or directive which will send event to google analytics based on your rul.

Upvotes: 1

Stefan Filip
Stefan Filip

Reputation: 1801

Since your content will basically be rendered after performing AJAX requests, Google is not able to crawl those pages. If you want this to happen I suggest you take a look at Prerender.io.

Upvotes: 1

Related Questions