【问题标题】:How to include a markdown file in index.html?如何在 index.html 中包含降价文件?
【发布时间】:2020-03-19 14:37:26
【问题描述】:

总之,我想在 template.html 中包含一个特定的降价文件。我怎么做?

我目前有一个about.md 页面,它使用我的主题中的page.html 模板呈现到about.html

我希望 about.md 在我的 index.html 模板中呈现,而不是这样。

我知道如何包含其他模板,例如。 {% include "index-sidebar.html" %}
但我想要像 {% include "about-rendered.html" %} 这样的东西,其中 about-rendered.html 是使用 about.md 源呈现的。

我在page.html模板中看到,markdown内容是用{{ page.content }}插入的。
也许有类似 {{ about.md.content }} 的东西?

【问题讨论】:

    标签: pelican


    【解决方案1】:

    模板中有大量数据可供使用。
    这对我有用。

    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 %}
    

    【讨论】:

      猜你喜欢
      • 2016-05-13
      • 1970-01-01
      • 2018-12-26
      • 1970-01-01
      • 1970-01-01
      • 2018-02-26
      • 2017-06-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多