在子布局中,是否可以定义一个 frontmatter 变量,其范围仅限于使用此布局的模板?
例如,给定一个子布局 child.hbs:
---
layout: parent.hbs
layout_script: childScript.js
---
和父布局parent.hbs:
{{#if layout_script}}
<script src="assets/js/{{layout_script}}">
{{/if}}
我希望我的父布局仅在从 child.hbs 继承的页面上包含脚本标记。相反,layout_script
它变成全局的,并且脚本在所有使用 parent.hbs 的页面上输出。