skip to Main Content

I created an angular2 website and while i build it i setup the meta title and description along the lines of what this tutorial did http://blog.devcross.net/2016/03/20/angular-2-seo/. This seemed to work and the title in the browser actual updated ok. The problem is that when i do a view source of the site it still only shows me the html source which resides in the main index.html file not the updated values.

When i check the source in the console with firebug lite it shows me updated meta titles and the description.

What am i doing wrong or missing?

2

Answers


  1. When you see the page’s source code, no javascript is executed, so you will not be able to see the changes aplied by Angular. This is normal. You aren’t doing anything wrong based on that.

    Login or Signup to reply.
  2. Since Angular4-beta.0 there is the Meta service

    constructor(private meta:Meta) {
      meta.addTag({ name: 'description', content: 'your description' })
    }
    

    For more details see https://github.com/angular/angular/pull/12322/files#diff-7979e98d95c45d21e56cf2602244f220R36

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search