Is calling the {{ partial }} helper the best solution for a sidebar?


I have a sidebar displaying on every page of my app except the index. I was curious if the best way to render this would be to just

{{ partial 'sidebar' }}

inside of every template? It seems like that would be a bit repetitive. It looks like this:


Or should I do something more like:

Ew.IndexRoute = Ember.Route.extend({
  activate: function(){
    this.controllerFor('application').set('isIndex', false);
 deactivate: function(){
    this.controllerFor('application').set('isIndex', false);

And then in application.hbs do:

{{#unless isIndex}}
  {{render 'sidebar'}}

Or should I do something completely different?


What you use largely depends on the use case. If this is going to be a fairly static list of links then partial would be the appropriate choice. If it is something more dynamic then a named outlet or a render might be what you want.

To avoid repetition this should probably be in your application template. It will then be present on every route.