【问题标题】:SEO in AngularJSAngularJS 中的 SEO
【发布时间】:2017-09-06 19:07:01
【问题描述】:

我有一个网站,每个部分包含一个页面。也就是说,每个版块都有一个带有自己的元标记的页面。

我如何使用 AngularJS 在一个页面中路由所有部分,而不会丢失在查找器中的存在,因为目前每个部分都有自己的元标记描述?

【问题讨论】:

  • 你需要在 HTML5 模式下进行 url 路由,然后爬虫才能爬取你的网站并能够保存数据

标签: angularjs seo ngroute


【解决方案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'
      }
    }
  });
  ...
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-07-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-16
    • 1970-01-01
    • 2015-11-07
    • 1970-01-01
    相关资源
    最近更新 更多