DEV Community 👩‍💻👨‍💻


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

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!

Top comments (0)

Classic DEV Post from 2020:

js visualized

🚀⚙️ JavaScript Visualized: the JavaScript Engine

As JavaScript devs, we usually don't have to deal with compilers ourselves. However, it's definitely good to know the basics of the JavaScript engine and see how it handles our human-friendly JS code, and turns it into something machines understand! 🥳

Happy coding!