1

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

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

_config.yml

collections:
  works:
    output: true

布局/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**.
4

1 回答 1

1

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

于 2018-03-25T20:18:07.850 回答