Search code examples
htmlmeteorspacebars

Meteor – How to use template helpers inside <head> element?


I want to be able to use Meteor template helpers to dynamically specify the content of a <meta> tag. It seems like there is no way to do this.

If I put the <meta> tag in a free-floating <head> element (i.e. not in a template), both will be included correctly in the HTML, but I can't use template helpers.

If I move the <meta> to a template, and try to render the template within a free-floating <head> element, it complains.

And if I move the whole <head> element into a template, now I have a <head> block nested within the <body>, which is ugly, and I suspect invalid HTML (though Chrome seems to handle it gracefully).

Is there a solution?


Solution

  • It is not currently possible to this without post load insertion due to they way Meteor parses templates