Simplify year archive Liquid
This commit is contained in:
parent
6e0ef33ec7
commit
9634bb84fb
4 changed files with 29 additions and 18 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### Enhancements
|
||||||
|
|
||||||
|
* Simplify year archive Liquid.
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
## [4.9.0](https://github.com/mmistakes/minimal-mistakes/releases/tag/4.9.0)
|
## [4.9.0](https://github.com/mmistakes/minimal-mistakes/releases/tag/4.9.0)
|
||||||
|
|
||||||
### Enhancements
|
### Enhancements
|
||||||
|
|
|
@ -4,10 +4,18 @@ permalink: /docs/history/
|
||||||
excerpt: "Change log of enhancements and bug fixes made to the theme."
|
excerpt: "Change log of enhancements and bug fixes made to the theme."
|
||||||
sidebar:
|
sidebar:
|
||||||
nav: docs
|
nav: docs
|
||||||
last_modified_at: 2018-01-04T22:50:34-05:00
|
last_modified_at: 2018-01-05T20:47:28-05:00
|
||||||
toc: true
|
toc: true
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## Unreleased
|
||||||
|
|
||||||
|
### Enhancements
|
||||||
|
|
||||||
|
* Simplify year archive Liquid.
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
## [4.9.0](https://github.com/mmistakes/minimal-mistakes/releases/tag/4.9.0)
|
## [4.9.0](https://github.com/mmistakes/minimal-mistakes/releases/tag/4.9.0)
|
||||||
|
|
||||||
### Enhancements
|
### Enhancements
|
||||||
|
|
|
@ -5,12 +5,10 @@ title: "Posts by Year"
|
||||||
author_profile: true
|
author_profile: true
|
||||||
---
|
---
|
||||||
|
|
||||||
{% capture written_year %}'None'{% endcapture %}
|
{% assign postsByYear = site.posts | group_by_exp:"post", "post.date | date: '%Y'" %}
|
||||||
{% for post in site.posts %}
|
{% for year in postsByYear %}
|
||||||
{% capture year %}{{ post.date | date: '%Y' }}{% endcapture %}
|
<h2 id="{{ year.name | slugify }}" class="archive__subtitle">{{ year.name }}</h2>
|
||||||
{% if year != written_year %}
|
{% for post in year.items %}
|
||||||
<h2 id="{{ year | slugify }}" class="archive__subtitle">{{ year }}</h2>
|
{% include archive-single.html %}
|
||||||
{% capture written_year %}{{ year }}{% endcapture %}
|
{% endfor %}
|
||||||
{% endif %}
|
|
||||||
{% include archive-single.html %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
|
@ -5,13 +5,10 @@ title: "Posts by Year"
|
||||||
author_profile: true
|
author_profile: true
|
||||||
---
|
---
|
||||||
|
|
||||||
{% include base_path %}
|
{% assign postsByYear = site.posts | group_by_exp:"post", "post.date | date: '%Y'" %}
|
||||||
{% capture written_year %}'None'{% endcapture %}
|
{% for year in postsByYear %}
|
||||||
{% for post in site.posts %}
|
<h2 id="{{ year.name | slugify }}" class="archive__subtitle">{{ year.name }}</h2>
|
||||||
{% capture year %}{{ post.date | date: '%Y' }}{% endcapture %}
|
{% for post in year.items %}
|
||||||
{% if year != written_year %}
|
{% include archive-single.html %}
|
||||||
<h2 id="{{ year | slugify }}" class="archive__subtitle">{{ year }}</h2>
|
{% endfor %}
|
||||||
{% capture written_year %}{{ year }}{% endcapture %}
|
|
||||||
{% endif %}
|
|
||||||
{% include archive-single.html %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
Loading…
Reference in a new issue