- Notifications
You must be signed in to change notification settings - Fork9
A liquid include file for Jekyll for grouping by an array
License
NotificationsYou must be signed in to change notification settings
mushishi78/jekyll-group-by-array
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
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 thegroup-by-array.html file into your Jekyll project's_includes directory.
Include the file in your template, passing in acollection and afield variable. Then Jekyll Group-By-Array will setgroup-names andgroup-items global variables with the results.
For example:
---layout: pagetitle: Tagspermalink: /tags/---{%includegroup-by-array.htmlcollection=site.postsfield='tags' %}<ul> {%fortagingroup_names %} {%assignposts =group_items[forloop.index0] %} <li> <h2>{{tag }}</h2> <ul> {%forpostinposts %} <li> <ahref='{{site.baseurl }}{{post.url }}'>{{post.title }}</a> </li> {%endfor %} </ul> </li> {%endfor %}</ul>For an extended example, checkout out thisgroup-by-array example branch of the Fresh Jekyll repository.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create a new Pull Request
About
A liquid include file for Jekyll for grouping by an array
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
No releases published
Packages0
No packages published