Navigation Slug inside a Partial?

I’m trying to have Ghost dynamically populate the icon in based on the navigation slug. However, it’s telling me this isn’t valid. Is there a way to make this work the way I’m intending?

{{#foreach navigation}}
	<li class="{{slug}}{{#if current}} nav-current{{/if}}">
		<a href="{{url absolute="true"}}" title="{{label}}" class="dropdown-link">
			{{> "icons/{{slug}}"}}

Is this a partial living in partials/navigation.hbs ?

And are you calling it as {{navigation}}, not as {{> navigation}} ?

Although the two look about the same, {{navigation}} gets all the context set right, while {{> navigation}} does not. (You can pass in variables to either one.)

(reads again) Oh, hang on, it’s probably that you’re trying to dynamically call that partial. I don’t think that’s supported. Instead do {{> icon" icon=slug}} and then from partials/icon.hbs, you’re going to need something like:

{{#match icon “=” “heart”}}
{{> heart}}
{{else match icon = “tree”}}
{{> tree}}


Which will be a pain to set up, but you only have to do it once if you abstract it into its own partial.