I read “Document.title integration into Ember” to get one approach to implement SEO in my App. The current proposal uses window.document.title to update the title property.
Ember.Router.reopen({
updateTitle: function() {
this.send('collectTitleTokens', []);
}.on('didTransition'),
setTitle: function(title) {
window.document.title = title;
}
});
In my case, I would like also including other meta tags (already discussed here) and comes to mind one of the Ember limitation (correct me if I am wrong), is that Ember Templates/Views/Routing… works only in the context of the Application root html element (commonly the body)
I propose providing the ability to insert a component outside of the Ember Application root context. The design API is influenced by the Ember API (creating the content template based on inline script tags) and rails.contentFor.
<script type="text/x-content-handlebars" data-content-name="seo">
<title>{{title}}</title>
<meta name="description" {{bind-attr content=description}} >
</script>
route.contentFor('seo', {title: 'title page', description:'description page});
We could define the context of the component based on a application controller.
<script type="text/x-content-handlebars" data-content-name="seo" controller="application">
<title>{{seoTitle}}</title>
<meta name="description" {{bind-attr content=seoDescription}} >
</script>
this.controllerFor('application').setProperties({title: 'title page', description:'description page});
This API does not try to replace the current title proposal, so far it could be used in a more different scenarios.
Feedback?