How to conditionally render partials in Ghost template

Partials can be used as reusable components to make your templates more modular.

Say you added a file in /partials/signup-form.hbs , it can be called in using:

{{> "signup-form"}}

You can also conditionally render the contents inside the partial like so:

{{> "signup-form" dark=true}}

Your signup-form.hbs could look like:

{{#if dark}}
        <p> You passed in dark </p>
{{else}}
        <p> You passed in not dark </p>
{{/if}}
Didn't find this guide useful? Let me know