Jekyll:访问 collection 的属性?

Jekyll: Access attribute of collection?

我正在尝试创建第二个表现相似的 _posts(它可以链接到,它有自己的布局,它存储在 _works 文件夹中,每件作品都有标题some-name.md).

一切正常,除了我找不到如何访问该降价文件的 frontmatter 属性...唯一有效的变量是 {{content}},但我想访问所有其他属性。

_config.yml

collections:
  works:
    output: true

layouts/work.html

---
layout: default
---

<div class="work-single">
  <h1>{{ work.title }}</h1> ... doesnt work
  <h2>{{ work.subtitle }}</h2> ... doesnt work

  {{ content }}
</div>

_works/test-product.md

---
layout: work
date: 2018-03-25 01:00:00 +0900
category: illustration
title: A test work product image
subtitle: This is a great product
---

Here is a test of a product which uses **markdown**.

在模板内部,page 对象可用:{{ page.title }},依此类推。