Jekyll site.categories.{{variable}}? [英] Jekyll site.categories.{{variable}}?
本文介绍了Jekyll site.categories.{{variable}}?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想用Jekyll文档中的示例生成器制作一个存档页面.生成器工作正常,但我不知道如何正确实现布局.到目前为止,我正在使用以下文件:
I want to make an archive page with the example generator from the Jekyll documentation. The generator works fine but I don't know to implement the layout correctly. I am using the following file so far:
{% assign cat = page.category %}
<div class="category-archive">
<div>
<span class="title">Category archive for {{ cat }}</span>
</div>
<div>
{{ cat }}
<ul class="posts">
{% for post in site.categories.cat %}
<li><span>{{ post.date | date_to_string }} - </span> <a href="{{ post.url }}">{{ post.title }}</a></li>
{% endfor %}
</ul>
</div>
</div>
如何使用page.category
中的当前类别,就像我要在此处使用的变量一样?
How can I use the current category from page.category
like with a variable I am trying to use here?
TL; DR
我想在site.categories.*
TL;DR
I want to use a liquid variable at site.categories.*
推荐答案
循环的正确语法是
{% for post in site.categories[cat] %}
这篇关于Jekyll site.categories.{{variable}}?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文