在我的化身博客已經有一個列出所有類別及其各自所有的帖子的網頁,這裏是代碼:IF在傑基爾降價邏輯
{% for category in site.categories %}
<div class="col-md-12 content-panel articles">
<h2 id="{{ category | first }}-ref">{{ category | first }}</h2>
<ul style="list-style: none;">
{% for posts in category %}
{% for post in posts %}
<li>
<!-- problem of for cycle can't use images <img src="/{{ post.header-img | prepend: site.baseurl }}" class="img-responsive" alt="{{ post.title }}"> -->
<h3><a href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a></h3>
<small class="hidden-xs">{{ post.date | date: "%B %-d, %Y" }}</small>
</li>
{% endfor %}
{% endfor %}
</ul>
</div>
{% endfor %}
我的問題是,我怎麼能只顯示例如categoryX
的帖子?
我意識到這可能是簡單的東西,但無法找到任何地方如何,我試圖改變for posts in category
到for posts in categoryX
但它沒有工作
存儲庫網址可以幫助發現問題。 –