Jekyll:页面不从布局解析自定义变量

Jekyll: Page not parsing custom variable from layout

我刚刚开始学习 Jekyll,我 运行 遇到了一点速度障碍。

我的 _layout 文件夹中有 2 个布局,它们基本上如下所示:-

default.html

<html>
<head> <!-- Meta Tags etc --> </head>
<body>
    {{ content }}
</body>
</html>

hero.html

---
layout: default
---
<section id="hero">
    <h3>{{ hero.descr }}</h3>
</section>
{{ content }}

我的索引页扩展英雄布局如下:-

index.html

---
layout: hero
descr: Hello there.
---

布局工作正常,网站显示正常,hero.descr 变量除外。标题标签是空的。

数据流是单向的。 default.html => hero.html => index.html

hero.html 将不知道 index.html

中定义的内容

但是,渲染方向相反(插入到父级的{{ content }}变量中。

index.html ==> hero.html ==> default.html

在我看来变量{{ hero.descr }}不存在。我认为应该是 {{ page.descr }}.