Skip to content

Commit 6ab4ffd

Browse files
authored
Fix year delimiters in releases page (#1615)
The previous approach to detect if a release is the last one in a year was incorrect. It checked if the following post was in the next year. However, the following post doesn't have to be a release, so the check could fail. The result was missing year delimiters "Releases in YYYY". A mutable variable makes it easier to track the actual year of the last rendered release post.
1 parent f0c9504 commit 6ab4ffd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

templates/releases.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
{%- set day = page.components | nth(n=num_comps - 2) | int %}
3333
{%- if loop.index0 == 0 %}
3434
{{ macros::show_year(year=year, post_name="Releases") }}
35+
{%- set_global prev_year = year %}
3536
{%- endif %}
3637

3738
{%- if page.extra is containing("release") %}
3839
{%- if loop.index0 != 0 %}
39-
{%- set prev_idx = loop.index0 - 1 %}
40-
{%- set prev_year = rev_pages[prev_idx].components | nth(n=num_comps - 4) | int %}
4140
{%- if prev_year != year %}
4241
{{ macros::show_year(year=year, post_name="Releases") }}
42+
{%- set_global prev_year = year %}
4343
{%- endif %}
4444
{%- endif %}
4545
{% if page.show_year %}<tr>

0 commit comments

Comments
 (0)