scratching my head over this - help much appreciated.
I want to display a list of all my Jekyll posts, organised by category. I know Line 3 isn\'t correct but I can
Now there is an official plugin available for this. jekyll-archives.
In order to make use of it,
Add jekyll-archives
to your Gemfile
and _config.yml
file.
add a configuration something similar to the below as per your need.
jekyll-archives:
enabled: all
layouts:
year: archive/year
month: archive/month
day: archive/day
tag: archive/tag
category: archive/category
permalinks:
year: '/:year/'
month: '/:year/:month/'
day: '/:year/:month/:day/'
tag: '/tags/:name/'
category: '/category/:name/'
The layouts
can make use of the following page attributes depending on the archive type
.
year
, month
, day
, tag
, category
)Nil
otherwise.)page.type
you should parse out the date and month field )Here is a sample layout for archive based on years
Archive of posts from {{ page.date | date: "%Y" }}
{% for post in page.posts %}
-
{{ post.date | date: "%b %-d, %Y" }}
{{ post.title }}
{% endfor %}