首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >如何在index.html中包含标记文件?

如何在index.html中包含标记文件?
EN

Stack Overflow用户
提问于 2020-03-19 22:37:26
回答 1查看 140关注 0票数 0

总之,我想在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 }}这样的东西?

EN

回答 1

Stack Overflow用户

发布于 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

代码语言:javascript
运行
复制
{% for p in pages %}
{% if p.title == 'About' %}
{{p.content}}
{% endif %}
{% endfor %}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60759348

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档