A liquid include file for Jekyll for grouping by an array
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Jekyll Group-By-Array

A liquid include file for Jekyll that allows an object to be grouped by an array. For instance, it could be used to list posts by tag.


Copy the group-by-array.html file into your Jekyll project's _includes directory.

Include the file in your template, passing in a collection and a field variable. Then Jekyll Group-By-Array will set group-names and group-items global variables with the results.

For example:

layout: page
title: Tags
permalink: /tags/

{% include group-by-array.html collection=site.posts field='tags' %}

  {% for tag in group_names %}
    {% assign posts = group_items[forloop.index0] %}

      <h2>{{ tag }}</h2>
        {% for post in posts %}
          <a href='{{ site.baseurl }}{{ post.url }}'>{{ post.title }}</a>
        {% endfor %}
  {% endfor %}

For an extended example, checkout out this group-by-array example branch of the Fresh Jekyll repository.


  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request