SEO for Universal starter

2017-03-05 15:07:00

Meta tags in Universal

As we expected on SSR systems to render all contents before send to client side, we also expected that do same thing for meta tags.

Universal supports meta tags modification fortunately.

So what we have to do?

  • Add and import Meta to Component like below in construction.

                    constructor(public meta:Meta) {
    
                    }
                
  • import MetaDefinition to Component and make an array of MetaDefinition

                     let desc:Array < MetaDefinition > = [
                {name: 'description', content: "What ever ......"},
                {name: 'keywords', content: "a,b,c,d,e....."}
            ];
                
  • add your variable to:

                    this.meta.addTags(desc);
                

I would recommend to use below Meta service by: Omar Gaayeb

https://gist.github.com/orgbx/af6a2920b5d66a5e04972719f46cb71f

Happy Coding!

Tags Cloud

Universal

Angular2

SEO

meta tags

add meta

Universal meta tag SSR

angular 2 universal meta tag

ng2 meta tag ssr

isomorphic