ZaneA / Liquid-Sort

Custom Liquid tag for sorting an array based on key.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Liquid-Sort

A custom tag for the Liquid templating engine (and therefore Jekyll) that allows you to sort an array by a key.

Usage

If you're using Jekyll you can simply clone this repository into your _plugins folder to begin using it, otherwise place it somewhere where it will be read by your application.

To use it, place it somewhere where it can access the array you'd like to sort. For example, using the Liquid-GitHub extension:

{% github user: ZaneA %}
  {% sort var: repos by: pushed_at direction: up %}
  {% for repo in repos %}
    <h3>{{ repo.name }}</h3>
    {{ repo.description | markdownify }}
  {% endfor %}
{% endgithub %}

I also use it along with the Jekyll-Models extension:

{% sort var: site.projects by: mdl_name %}

About

Custom Liquid tag for sorting an array based on key.

License:MIT License


Languages

Language:Ruby 100.0%