通过邮寄yml前面事项编号订购帖子

时间:2014-03-07 02:29:57

标签: jekyll

我将每个帖子都作为一个公司在一个建筑物中,我想通过suite在每个帖子的yml前端设置每个帖子(公司)。我怎么能这样做?

1 个答案:

答案 0 :(得分:1)

Here's another question that asked something similar,只需"常规"页面而不是博客文章。

根据您的需要调整已接受的答案suite和帖子,而不是weight和网页),您需要执行以下操作:

在每个帖子的前端定义suite

---
layout: post
title: whatever
date: 2014/04/19 00:00
suite: 3
---

显示按suite排序的所有帖子的列表:

<ul>
{% for suite in (1..10) %}
    {% for post in site.posts %}
        {% if post.suite == suite %}
            <li><a href="{{ post.url }}">{{ post.title }}</a></li>
        {% endif %}
    {% endfor %}
{% endfor %}
</ul>
相关问题