Using {{!< default}} inside a condition

Hi everyone,

I’m creating a multi-language blog with ghost with english and french language. So, in addition of default.hbs, I created a default-fr.hbs to translate and include french partials.

In my post.hbs, I struggle to include the right “default” template into a condition like this :
{{#has tag="#fr"}}
{{!< default-fr}}
{{!< default}}

default-fr is already included even if there no tag.

Where I’m wrong ?
Thanks in advance

Hey @franckmaurin :wave:

Layouts aren’t like helpers or partials, rather they’re special syntax for the Ghost Handlebars parser.

There’s a tutorial that provides guidance for sites with multi-lingual content:

Hi @vikaspotluri123 and thanks for your answer.

I’ve already read your link and, unfortunately, it don’t answer to my question : how can I set my layout depending a condition.

So I finally find a solution (very unaesthetic but it’s works):

{{#has tag="#fr"}}
    {{#contentFor "lang"}}fr{{/contentFor}}
    {{#contentFor "header"}}{{>site-nav-fr}}{{/contentFor}}
    {{#contentFor "footer"}}{{>site-footer-fr}}{{/contentFor}}
    {{#contentFor "lang"}}en{{/contentFor}}
    {{#contentFor "header"}}{{>site-nav}}{{/contentFor}}
    {{#contentFor "footer"}}{{>site-footer}}{{/contentFor}}
{{!< default}}

If I wasn’t clear, you can’t do that.

What you can do, however, is use dynamic routing to specify what layout to use, which was outlined in the linked tutorial :wink: