总之,我想在template.html中包含一个特定的标记文件。我该怎么做?
我目前有一个about.md页面,它在我的主题中使用page.html模板呈现为about.html。
相反,我希望在我的index.html模板中呈现about.md。
我看到了如何包含其他模板,例如。{% include "index-sidebar.html" %}
但是我想要像{% include "about-rendered.html" %}这样的文件,其中about-rendered.html是使用about.md源代码呈现的。
我看到在page.html模板中,用{{ page.content }}插入了标记内容。
也许有像{{ about.md.content }}这样的东西?
发布于 2020-03-20 09:58:56
在模板中有很多可用的数据。
这就是对我有效的方法。
https://docs.getpelican.com/en/stable/themes.html#common-variables
https://docs.getpelican.com/en/stable/themes.html#page
{% for p in pages %}
{% if p.title == 'About' %}
{{p.content}}
{% endif %}
{% endfor %}https://stackoverflow.com/questions/60759348
复制相似问题