3
有没有方法可以访问其父级布局中的子布局中定义的YFM属性?嵌套布局变量
例如,给定一个子布局page.hbs:
---
layout: wrapper.hbs
no_header: true
----
<div class="wrapper">{{> body }}</div>
我想访问父布局wrapper.hbs在page.hbs定义的no_header
YFM属性:
<html>
<body>
{{#unless layout.no_header}}<header></header>{{/if}}
{{> body }}
</body>
</html>
我不能得到那个工作。也许我做错了什么。 此页面:https://github.com/optimizely/marketing-website/blob/krush/layout-variables/website/free-trial/index.hbs 使用此布局:https://github.com/ optimizely/marketing-website/blob/krush/layout-variables/website-guts/templates/layouts/simple.hbs 仍有头文件。难道我做错了什么? –
@KyleRush使用'page'是错误的。 'content_header'显示在上下文的根部。 – doowb
啊,删除页面。作品。谢谢! –