Ad

SEO Optimization Of Angular.JS Project

- 1 answer

guys! Need the help. I am developing a project on Angular and my PM asked me to perform its SEO optimization. I don`t know where to start. Can you provide me with a code example, please?

Ad

Answer

First of all, you should form title meta tags and description.

const metaTags = {
    get(metaTagName) {
        switch (metaTagName) {
            case `titleMeta`:
                return angular.element(`meta[property="og:title"]`);
            case `descriptionMeta`:
                return angular.element(`meta[property="og:description"], meta[name="description"]`);
        }
    }

}

Now, you have to create the function which will receive our title in a form of string through the parameters.

const metaTags = {
    get(metaTagName) {
        switch (metaTagName) {
            case `titleMeta`:
                return angular.element(eta`:
                return angular.element(`meta[property="og:title"]`);
            case `descriptionMeta`:
                return angular.element(`meta[property="og:description"], meta[name="description"]`);
        }
    },

    set({ title, description }) {
        if (!angular.isUndefined(title)) {
            this.get(`titleMeta`).prop(`content`, title);
        }
        if (!angular.isUndefined(description)) {
            this.get(`descriptionMeta`).prop(`content`, description);
        }
    }
}

The first steps are passed. This article will help you to complete SEO optimization process very quikly and easily. http://computoolsglobal.com/blog/angular-seo-optimization/

Ad
source: stackoverflow.com
Ad