Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nested layout variables

Tags:

assemble

Is there a way to access YFM properties defined in a child layout in its parent layout?

For example, given a child layout page.hbs:

---
layout: wrapper.hbs
no_header: true
----
<div class="wrapper">{{> body }}</div>

I'd like to access the no_header YFM property defined in page.hbs in the parent layout wrapper.hbs:

<html>
    <body>
        {{#unless layout.no_header}}<header></header>{{/if}}
        {{> body }}
    </body>
</html>
like image 834
Kyle Rush Avatar asked Jan 01 '26 05:01

Kyle Rush


1 Answers

The front matter merges up so you should be able to get it on the root of the context.

Try doing {{#unless no_header}}.

Edit: updated based on comment below.

like image 173
doowb Avatar answered Jan 06 '26 17:01

doowb



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!