angularjsseongroute

SEO in AngularJS


I have a web site that includes one page per section. That is to say that every section have one page with her own meta tags.

How do I route all sections in one page with AngularJS without lose presence in finders being currently every section has her own meta tag description?


Solution

  • NgMeta can help you.

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