我有一个使用 Jekyll 支持的食谱网站,现在我想将微数据(itemscope
、、itemprop
等)添加到输出静态页面中。我有几个列表(成分、方向等),我不确定如何让 Jekyll 渲染这些并添加微数据。
我假设我需要一个转换器或过滤器或其他一些东西,但我几乎没有使用 Jekyll 的经验。以前有人做过类似的事情吗?
我有一个使用 Jekyll 支持的食谱网站,现在我想将微数据(itemscope
、、itemprop
等)添加到输出静态页面中。我有几个列表(成分、方向等),我不确定如何让 Jekyll 渲染这些并添加微数据。
我假设我需要一个转换器或过滤器或其他一些东西,但我几乎没有使用 Jekyll 的经验。以前有人做过类似的事情吗?
在kramdown 文档中找到了一种方法
但是如果:
我的食谱.md
---
layout: page
title: My nice recipe
ingredients:
- 2 tablespoons butter
- 1 cup diced onion
- 1 cup shredded carrot
---
{% include recipe_head.html %}
###How to do it
...
**_includes/recipe_head.html
<h3>{{ page.title }}</h3>
<h4>Ingredients</h4>
<ul>
{% for ingredient in page.ingredients %}
<li itemprop="ingredient">{{ ingredient }}</li>
{% endfor %}
</ul>
这将更易于维护。