DEV Community

munishsinghal
munishsinghal

Posted on

Dynamically add meta tag in angular

I am working on an angular project. Where the requirement to hide particular page from google search. Google recommend to add
in html page.

But here in my requirement all the angular components are loaded dynamically, so I cannot add meta tag in index.html at design time. So I find a solution to add it at runtime, depending upon some conditions. I followed below link to implement same

https://stackoverflow.com/questions/48330535/dynamically-add-meta-description-based-on-route-in-angular

Even there are many other links which provide same solution.

Now after this implementation, if I made check in code, if the meta tag is added then worked. Even, if I inspect in browser I can see the meta tag in script.

But if I go to browser view source then it does not show, seems it is already rendered. So here I have 2 queries.
1) will this dynamically added meta tag be considered by google indexing(search engine)?
2) If not then what is the other way round which can help me fixing this or even if I can see in view source as well?

Any help/response highly appreciated!

Latest comments (0)