【问题标题】:assemble.io - context of yaml data in partials not workingassemble.io - 部分中的 yaml 数据的上下文不起作用
【发布时间】:2014-09-08 09:14:04
【问题描述】:

我在使用 Assemble 在部分内容中呈现 YAML 内容时遇到问题

这是我的细分:

layout/deafualt.hbs

<body>
        {{pagetitle}} <!-- THIS WILL RENDER 'HELLO WORLD' FINE -->
        <header role="banner">
            {{> _header }}
        </header>
        <main role="main">
            {{> body }}
        </main>
        <footer role="contentinfo">
            {{> _footer }}
        </footer>
    </body>

pages/car.hbs

---
pagetitle: "HELLO WORLD"
---
{{#car }}
    {{> banner }}
    {{> content }}
    {{> explore }}
    {{> feature }}
    {{> social }}
{{/car }}

modules/content.hbs

<h1>{{pagetitle}}</h1> <!-- THIS ***WON'T*** RENDER 'HELLO WORLD'-->
<h>Im a sub-heading</h2>

我想这与上下文有关,但我尝试了各种排列都无济于事。

非常感谢任何指针。

一个。

【问题讨论】:

    标签: yaml assemble


    【解决方案1】:

    这不仅仅是 Assemble 的车把问题。使用把手在嵌套块中使用局部时会变得很棘手。

    鉴于您的示例,在 content.hbs 中尝试执行 {{car.pagetitle}},因为您在 {{#car}}...{{/car}} 块内。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-05-31
      • 1970-01-01
      • 2013-04-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-29
      • 2018-11-04
      相关资源
      最近更新 更多