2
votes

I have each post as a company in a building and I wanna order each post (company) by suite a number set in the yml front-matter of each post. How can I do this?

1

1 Answers

1
votes

Here's another question that asked something similar, just with "regular" pages instead of blog posts.

Adapting the accepted answer to your needs (suite and posts, instead of weight and pages), you need to do the following:

Define a suite in the front-matter of each post:

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

Display a list of all posts sorted by 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>