Assemble, Handlebars partial, YAML Front matter

651 views Asked by At

I have a partial... e.g: partial.hbs

<h1>{{title}}</h1>

I want to use this partial but pass the YAML "title" in another partial e.g: page.hbs

---
 title: hello
---
{{> partial}}

is this possible without writing a custom helper?

1

There are 1 answers

0
waynedpj On BEST ANSWER

in Assemble 0.4.x with Handlebars 2.x you should be able to pass arguments to partials, so your use of the partial.hbs would be something like:

page.hbs

---
 title: hello
---
{{> partial title=title}}

just be sure you are using Handlebars <=2.0 which supports partial parameters/arguments.

otherwise you could take a look at the handlebars-helper-partial which can do this with <2.0 Handlebars.

hope this helps.