"Partials" in Ghost are snippets of code housed in small HTML files that can be used within other template files. They always live in the /partials
folder of a theme.
You can include them within a template like this:
<div>
{{> "comments"}}
</div>
This would load the HTML from partials/comments.hbs
into the page.
In some cases, you may want to pass data into a partial from the parent template file.
This is done simply by listing the data after the partial name, like this:
<div>
{{> "comments" show_something=true}}
</div>
Now the variable show_something
is true
within the partials/comments.hbs
partial file.
Thanks for reading!
I am the founder of Codelet. I have five years experience publishing and developing for Ghost, on over 100 sites. Codelet publishes Ghost themes, blog posts and offers expert Ghost support.