Mark Trapp

Jekyll Post Group Generator

This plugin provides a generator for grouping posts by arbitrary front-matter keys. Jekyll provides two grouping variables for posts: site.categories and site.tags. This plugin provides a method to create groups for any other key you’d like.


This plugin is provided as a gem:

gem install jekyll-itafroma-post_groups

Once the gem is installed, include it in your Jekyll site's configuration:

gems: ['jekyll/itafroma/post_groups']


This plugin is configured using a sequence of mappings named post_groups:

    - key: section
      group: sections
      exclude: ['Philosophy']

Each mapping has the following keys:

  • key: (required) The name of the front-matter key to group on.
  • group: (required) Used to name the site.* variable (e.g., site.sections for the front-matter key section). Note: this cannot be the same name as a built-in Jekyll variable.
  • exclude: (optional) A sequence of values that should be excluded from the grouping. In the example above, posts keyed with section: Philosophy will be excluded from site.sections.


Each post group will be within the site variable:

{% for section in site.sections %}
    <h1>{{ section | first }}</h1>
    {% for post in section %}
        <h1>{{ post.title }}</h1>
    {% endfor %}
{% endfor %}

Copyright and license

This plugin is copyright © 2014 Mark Trapp. All rights reserved. It is made available via the MIT license. A copy of the license can be found in the LICENSE file.

Related links

Comments and feedback are welcome and appreciated. Need help on your next project? Let's talk.