Dynamically Added Meta Data,keywords,title using AngularJS

Dynamically Added Meta Data,keywords,title using AngularJS

Today, We want to share with you Dynamically Added Meta Data,keywords,title using AngularJS.
In this post we will show you Dynamically Added Meta Data,keywords,title using AngularJS, hear for Dynamically Added Meta Data,keywords,title using AngularJS we will give you demo and example for implement.
In this post, we will learn about Dynamically Added Meta Data,keywords,title using AngularJS with an example.

In order to solve this SEO related problem, we decided to try to google search engine understand pages or post by executing JavaScript or angular. It’s hard to do that all the pages at the scale of the current web or web pages, but we decided that all as well as it’s worth it. We have been most type level gradually improving all the meta tags how we do this for some time and indexing. In the past information few months of the data, our indexing system related data dynamically has been rendering a substantial number of web pages or web app’s more like an average data of the more user’s browser with more js with JavaScript turned on.In this post For : Dynamically Added Meta Data,keywords,title using AngularJS

READ :  Angular Live Autosuggest Autocomplete textbox

AngularJS and Title tags in SPA mode Example

The solutions is based AngularJS With SEO on free or open source framework technologies, like JavaScript framework more ( AngularJS framework, React framework, etc) and NodeJS with Express with seo example. for in this POST,Dynamically Added Meta Data,keywords,titletag Indexed By Google Crawlers

 .service('PageTitle', function() {
      var title = 'Productmate';
      return {
        title: function() { return title; },
        setTitle: function(newTitle) { title = newTitle; }
      };
    });

ng-bind prevents flickering

<title ng-bind="PageTitle.title()"></title>
<update-meta property="og:title" content="{{ title }}"></update-meta>

AngularJS and metaDescription keywords with in SPA mode Example

 .service('MetaInformation', function() {
      var metaDescription = '';
      var pagemetaKeywords = '';
      return {
        metaDescription: function() { return metaDescription; },
        pagemetaKeywords: function() { return pagemetaKeywords; },
        reset: function() {
          metaDescription = '';
          pagemetaKeywords = '';
        },
        setMetaDescription: function(newMetaDescription) {
          metaDescription = newMetaDescription;
        },
        appendpagemetaKeywords: function(newKeywords) {
          for (var key in newKeywords) {
            if (pagemetaKeywords === '') {
              pagemetaKeywords += newKeywords[key].name;
            } else {
              pagemetaKeywords += ', ' + newKeywords[key].name;
            }
          }
        }
      };
    });

In the template:

READ :  AngularJS Single page app with dynamic meta - AngularJS SEO

<meta name="description" content="{{ MetaInformation.metaDescription() }}">
<meta name="keywords" content="{{ MetaInformation.metaKeywords() }}">

Example of meta , title , description and keywords using SEO

<html ng-app="myApp" ng-controller="AppController">
<head>
    <meta title="{{ metadata.title }}" ng-if="metadata.title" />
    <meta description="{{ metadata.description}}" ng-if="metadata.description" />
    <meta whatever="{{ metadata.whatever}}" ng-if="metadata.whatever" />
</head>

Script part using AngularJS

function SomePageController($scope) {
   $scope.$emit('newPageLoaded', { 'title': 'abouts page', 'description': 'We are Web Technology Experts Team who provide you Important information on Web Development, Interview Questions and Answers, live project problem and their solution and online free tutorials - "ng4free.com".' });
}
function AppController($scope) {
    $scope.metadata = {
        'title': 'Angularjs with SEO',
        'description': 'AngularJS and Title tags in SPA mode Example',
    };
    $scope.$on('newPageLoaded', function(event, metadata) {
        $scope.metadata = metadata
    });
}

Full Example of Update meta tags in AngularJS

<html ng-app="app">
    <title ng-bind="metaservice.metaTitle()">Angularjs King</title>
    <meta name="description" content="{{ metaservice.metaDescription() }}" />
    <meta name="keywords" content="{{ metaservice.metaKeywords() }}" />


<script>
    var app = angular.module('app',[]);
    app.service('MetaService', function() {
       var title = 'Web App';
       var metaDescription = '';
       var metaKeywords = '';
       return {
          set: function(newTitle, newMetaDescription, newKeywords) {
              metaKeywords = newKeywords;
              metaDescription = newMetaDescription;
              title = newTitle; 
          },
          metaTitle: function(){ return title; },
          metaDescription: function() { return metaDescription; },
          metaKeywords: function() { return metaKeywords; }
       }
    });

   app.controller('myCtrl',function($scope,$rootScope,MetaService){
      $rootScope.metaservice = MetaService;
      $rootScope.metaservice.set("Web App","desc","blah blah");
   });
</script>
 <body ng-controller="myCtrl"></body>
</html>

We hope you get an idea about Dynamically Added Meta Data,keywords,title using AngularJS
We would like to have feedback on my Information blog .
Your valuable any feedback, Good question, Inspirational Quotes, or Motivational comments about this article are always welcome.
If you liked this post, Please don’t forget to share this as Well as Like FaceBook Page.

READ :  Angularjs Loading Progress Bar percentage spinner

We hope This Post can help you…….Good Luck!.

Add a Comment

Your email address will not be published. Required fields are marked *