How to change the default order pages in Jekyll?

You can create custom order of your menu items like this:

  1. In your pages front matter add the order field (you can name it as you prefer)
    ---
    layout: default
    published: true
    title: Page title
    order: 1
    ---
    
  2. When getting pages, apply the ‘sort’ filter
    {% assign sorted_pages = site.pages | sort:"order" %}
    {% for node in sorted_pages %}
      <li><a href="https://stackoverflow.com/questions/13266369/{{node.url}}">{{node.title}}</a></li>
    {% endfor %}
    

You’ll end up with an ordered (ASC) list of pages, based on the ‘order’ field value you add to each page.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)