循环 Pelican 元数据 Returns Null
Loop Over Pelican MetaData Returns Null
我正在尝试生成 list items
以创建 musicians
捐赠给当前 "active" charity
页面的列表。
慈善-test.md:
Title: Charity Test
Category: charities
Template: charity
音乐家-test.md
Title: Some Musician
Category: musicians
Template: musician
Charities: Charity Test
charity.html(模板):
{% extends "base.html" %}
{% block content %}
{% include 'parts/common/header-common.html' %}
{{ article.content }}
<h3>Donations made to {{ article.title }} by:</h3>
<ul>
{% for charity, articles in charities|sort %}
{% if charity == article.title %}
<li><a href="/{{ charity.url }}">{{ charity.title }}</a> ({{ categories|count }}) </li>
{% endif %}
{% endfor %}
</ul>
{% endblock content %}
应该return:
<h3>Donations made to Charity Test by:</h3>
<ul>
<li><a href="/some-musician.html">Some Musician</a>(1)</li>
</ul>
但是我得到:
<h3>Donations made to Charity Test by:</h3>
<ul>
</ul>
我也尝试过使用 'categories' 路线,但没有成功。我似乎无法理解这个问题。任何帮助将不胜感激。
发现 Pelican 的开箱即用功能是有限的,这是不可能的w/o 编写一个插件来支持这个循环。
我正在尝试生成 list items
以创建 musicians
捐赠给当前 "active" charity
页面的列表。
慈善-test.md:
Title: Charity Test
Category: charities
Template: charity
音乐家-test.md
Title: Some Musician
Category: musicians
Template: musician
Charities: Charity Test
charity.html(模板):
{% extends "base.html" %}
{% block content %}
{% include 'parts/common/header-common.html' %}
{{ article.content }}
<h3>Donations made to {{ article.title }} by:</h3>
<ul>
{% for charity, articles in charities|sort %}
{% if charity == article.title %}
<li><a href="/{{ charity.url }}">{{ charity.title }}</a> ({{ categories|count }}) </li>
{% endif %}
{% endfor %}
</ul>
{% endblock content %}
应该return:
<h3>Donations made to Charity Test by:</h3>
<ul>
<li><a href="/some-musician.html">Some Musician</a>(1)</li>
</ul>
但是我得到:
<h3>Donations made to Charity Test by:</h3>
<ul>
</ul>
我也尝试过使用 'categories' 路线,但没有成功。我似乎无法理解这个问题。任何帮助将不胜感激。
发现 Pelican 的开箱即用功能是有限的,这是不可能的w/o 编写一个插件来支持这个循环。