I am trying to set <title>appName {{version}}</title>
in the head tag, but doesn’t seem to work, even when I Session.set
at the topmost .js file.
Why can’t I do this?
I am trying to set <title>appName {{version}}</title>
in the head tag, but doesn’t seem to work, even when I Session.set
at the topmost .js file.
Why can’t I do this?
Head is not a template (I think) so you can’t use Spacebars in it.
Look at this package for example: https://github.com/DerMambo/ms-seo
Looks like an overkill, I guess in meteor we have to set the title dynamically via javascript…
I’ll have a look if it’s possible to provide either a package or a patch for Meteor/Blaze/wherever this concern lives so it would stop biting people.
If anyone has any pointers / additional info about this, then please post here or message! Thanks!
Yeah I mean, you don’t have to use the whole package, just look at how they do it
Well, actually it’s only document.title = title
that sets the title, which is the same as the title attribute
Set some title
<head>
<title>titletest titleVersion</title>
And than just replace it
if (Meteor.isServer) {
var currentVersion = 314;
Meteor.startup(function () {
// code to run on server at startup
Inject.rawModHtml('setTitle', function(html) {
return html.replace( 'titleVersion</title>',
currentVersion+'</title>');
});
});
};
any questions?
It is not exactly what u were asking, but this way it is not client side, so in theory you can define some stuff during load visible by indexing services etc.
package meteorhacks:inject-initial