Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

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.

Usage

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.

Contributing

  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

About

A liquid include file for Jekyll for grouping by an array

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp