11{% assign posts = site.categories[include.taxonomy] | where_exp: "item", "item.hidden != true" %}
2- {% assign group_by_year = include.group_by_year | default: true %}
32{% if include.author %}
4- {% assign posts = posts | where_exp: "post", "post.names contains include.author" %}
5-
6- {% comment %}
7- Ideally we want to use:
8- {% assign posts = posts | where_exp: "post", "post.names contains include.author or post.author == include.author" %}
9-
10- However it is not currently supported by Jekyll 3.9.2, which is what is being used by the GitHub Pages Gem. However,
11- the gem maintainers are currently working on upgrading jekyll to 4.x, which supports binary operator for where_exp:
12-
13- https://github.com/github/pages-gem/issues/651#issuecomment-1156978042
14- {% endcomment %}
15-
3+ {% assign posts = posts | where_exp: "post", "post.names contains include.author" %}
164{% endif %}
175
18-
196{% if include.disable_group_by_year == true %}
7+ < div class ="entries-{{ entries_layout | default: 'list' }} ">
208 {% for post in posts %}
21- {%- include display-publications.html %}
9+ {%- include display-publications.html %}
2210 {% endfor %}
11+ </ div >
2312{% else %}
13+ {% assign postsByYear = posts | group_by_exp: 'post', 'post.date | default: "9999-01-01" | date: "%Y"' %}
2414
25- {% assign postsByYear = posts | group_by_exp: 'post', 'post.date | date: "%Y"' %}
26-
15+ {% if postsByYear.size > 0 %}
2716{% unless include.hide_years_dropdown == true %}
28- < details >
17+ < details class =" publications-years " >
2918 < summary > Show years</ summary >
30- < ul class ="taxonomy__index ">
31- {% for year in postsByYear %}
32- < li >
33- < a href ="#{{ year.name }} ">
34- < strong > {{ year.name }}</ strong > < span class ="taxonomy__count "> {{ year.items | size }}</ span >
35- </ a >
36- </ li >
19+ < div class ="taxonomy__index ">
20+ {% assign sortedYears = postsByYear | sort: 'name' | reverse %}
21+ {% for year in sortedYears %}
22+ {% if year.name == "9999" %}
23+ {% assign yearName = "None" %}
24+ {% else %}
25+ {% assign yearName = year.name %}
26+ {% endif %}
27+ < a href ="#{{ yearName | slugify }} " class ="year-link ">
28+ < strong > {{ yearName }}</ strong > < span class ="taxonomy__count "> {{ year.items | size }}</ span >
29+ </ a >
3730 {% endfor %}
38- </ ul >
31+ </ div >
3932</ details >
4033{% endunless %}
4134
42- {% for year in postsByYear %}
43- < section id ="{{ year.name }} " class ="taxonomy__section ">
44- < h3 > {{ year.name }}</ h3 >
45- < div class ="entries-{{ entries_layout }} ">
46- {% for post in year.items %}
47- {%- include display-publications.html %}
48- {% endfor %}
49- </ div >
50- < a href ="#page-title " class ="back-to-top "> {{ site.data.ui-text[site.locale].back_to_top | default: 'Back to Top' }} ↑</ a >
51- </ section >
52- {% endfor %}
35+ {% assign sortedYears = postsByYear | sort: 'name' | reverse %}
36+ {% for year in sortedYears %}
37+ {% if year.name == "9999" %}
38+ {% assign yearName = "None" %}
39+ {% else %}
40+ {% assign yearName = year.name %}
41+ {% endif %}
5342
43+ < section id ="{{ yearName | slugify }} " class ="taxonomy__section ">
44+ < h3 class ="archive__subtitle "> {{ yearName }}</ h3 >
45+ < div class ="entries-{{ entries_layout | default: 'list' }} ">
46+ {% assign yearItems = year.items | sort: 'date' | reverse %}
47+ {% for post in yearItems %}
48+ {%- include display-publications.html %}
49+ {% endfor %}
50+ </ div >
51+ < a href ="#page-title " class ="back-to-top "> {{ site.data.ui-text[site.locale].back_to_top | default: 'Back to Top' }}
52+ ↑</ a >
53+ </ section >
54+ {% endfor %}
55+ {% endif %}
5456{% endif %}
0 commit comments