Skip to content

Commit 0b69583

Browse files
committed
reports.html: Create dynamic report listing by year
Replace hard coded year headings with auto-generated year headings for each unique year found in '_reports' files. Closes #670
1 parent 5e05aa1 commit 0b69583

File tree

1 file changed

+20
-22
lines changed

1 file changed

+20
-22
lines changed

reports.html

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,24 @@
22
title: coala GSoC project reports
33
---
44

5-
<h1>{{ page.title }}</h1>
5+
<!DOCTYPE html>
6+
<html>
7+
<head>
8+
<title>{{ page.title }}</title>
9+
<meta charset="utf-8">
10+
<link rel="stylesheet" href="../resources/css/style.css">
11+
</head>
612

7-
<h2>2018</h2>
8-
9-
<ul>
10-
{% for report in site.reports %}
11-
{% capture year %}{{ report.date | date: '%Y' }}{% endcapture %}
12-
{% if year == '2018' %}
13-
<li><a href="{{ report.url }}.html">{{ report.student }}</a>
14-
{% endif %}
15-
{% endfor %}
16-
</ul>
17-
18-
<h2>2017</h2>
19-
20-
<ul>
21-
{% for report in site.reports %}
22-
{% capture year %}{{ report.date | date: '%Y' }}{% endcapture %}
23-
{% if year == '2017' %}
24-
<li><a href="{{ report.url }}.html">{{ report.student }}</a>
25-
{% endif %}
26-
{% endfor %}
27-
</ul>
13+
<body class="report">
14+
<h1>{{ page.title }}</h1>
15+
{% assign reportsByYear = site.reports | group_by_exp:"report", "report.date | date: '%Y'" %}
16+
{% for year in reportsByYear reversed %}
17+
<h2>{{ year.name }}</h2>
18+
<ul>
19+
{% for report in year.items %}
20+
<li><a href="{{ report.url }}.html">{{ report.student }}: {{ report.project }}</a></li>
21+
{% endfor %}
22+
</ul>
23+
{% endfor %}
24+
</body>
25+
</html>

0 commit comments

Comments
 (0)