2017-04-11 99 views
0

我有一個網站,其中包含一個網頁每節。也就是說,每個部分都有一個帶有自己meta標籤的頁面。AngularJS中的SEO

如何使用AngularJS將所有部分路由到一個頁面中,而不會丟失在發現者中當前每個部分都有自己的元標記描述?

+0

您需要在HTML5模式下進行網址路由,然後抓取機器人可以抓取您的網站並能夠保存數據 – Webruster

回答

1

NgMeta可以看到你的工作。

.config(function ($routeProvider, ngMetaProvider) { 
    $routeProvider 
    .when('/home', { 
    templateUrl: 'home-template.html', 
    data: { 
     meta: { 
     'title': 'Home page', 
     'description': 'This is the description shown in Google search results' 
     } 
    } 
    }) 
    .when('/login', { 
    templateUrl: 'login-template.html', 
    data: { 
     meta: { 
     'title': 'Login page', 
     'titleSuffix': ' | Login to YourSiteName', 
     'description': 'Login to the site' 
     } 
    } 
    }); 
    ... 
});