[Solved] Can I put meta tag inside `<head>` conditionally? Is it possible?


#1

Hey folks, Can I put meta tag inside <head> conditionally? Is it possible?

For example I need to add <meta name="robots" content="noindex"> on some routes. I don’t use spiderable package, so it must rendered on server.


Change header meta tags based on whether the app is running in browser or as mobile app
#2

You can’t do it for some routes. It’ll apply to your whole app.


#3

I wanted to do this to update the <title> reactively - was not possible using template logic as the head is not part of the template :frowning:

Have a look at this SO answer: http://stackoverflow.com/a/2568915/601455


#4

Thank you. But I want to render it on server.


#5

oh yeah sorry that is true, it is no good if you wait for the client to update it.
not sure what the best way forward is.


#6

@arunoda I’m using https://meteorhacks.com/meteor-server-sider-rendering-for-seo-purpose.html this technique. So how about rendering on second response ( with _escaped_fragment_)? Does it block indexing?


#7

Ah! now I got it.
Yes, it’ll work.


#8

@arunoda Cool, thank you.