Skip to content

Commit ca03de6

Browse files
committed
Add /releases page
1 parent a1d8677 commit ca03de6

File tree

3 files changed

+73
-3
lines changed

3 files changed

+73
-3
lines changed

content/releases/_index.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
11
+++
2-
render = false
2+
title = "Rust Release Announcements"
3+
template = "releases.html"
4+
[extra]
5+
index_title = "The Rust Release Announcements"
6+
see_also_path = "/"
7+
see_also_text = "the main Rust blog"
38
+++

templates/macros.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
}}
3636
{%- endmacro escape_hbs %}
3737

38-
{% macro show_year(year) -%}
38+
{% macro show_year(year, post_name="Posts") -%}
3939
<tr>
4040
<td class="bn"></td>
41-
<td class="bn"><h3 class="f0-l f1-m f2-s mt4 mb0">Posts in {{ year }}</h3></td>
41+
<td class="bn"><h3 class="f0-l f1-m f2-s mt4 mb0">{{ post_name }} in {{ year }}</h3></td>
4242
</tr>
4343
{%- endmacro show_year %}

templates/releases.html

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{% import "macros.html" as macros -%}
2+
{% extends "layout.html" -%}
3+
{% block page -%}
4+
<header class="mt3 mt0-ns mb4-ns">
5+
<div class="container flex flex-column flex-row-l justify-between-l">
6+
<div class="mw6-l">
7+
<p>
8+
This is a subset of the <a href="/">main Rust blog</a>
9+
listing only official release annoucement posts.
10+
</p>
11+
<p>
12+
Did you know? There are convenient redirects for
13+
the latest and specific release posts:
14+
<br/><a href="/releases/latest">/releases/latest</a>
15+
<br/><a href="/releases/1.85.0">/releases/1.85.0</a>
16+
</p>
17+
</div>
18+
</div>
19+
<div class="container flex flex-column flex-row-l justify-between-l">
20+
<div class="mw8-l">
21+
<p>
22+
<b>See also:</b>
23+
<a href="{{ config.base_url | safe }}{{ section.extra.see_also_path | safe }}">{{ section.extra.see_also_text }}</a>
24+
</p>
25+
</div>
26+
</div>
27+
</header>
28+
29+
{% set section = get_section(path="_index.md") -%}
30+
<section id="posts" class="posts">
31+
<div class="w-100 mw-none ph3 mw8-m mw9-l center f3">
32+
33+
<table class="post-list collapse w-100 f2-l f2-m f3-s">
34+
{%- set rev_pages = section.pages | reverse %}
35+
{%- for page in rev_pages %}
36+
{%- set num_comps = page.components | length %}
37+
{%- set year = page.components | nth(n=num_comps - 4) | int %}
38+
{%- set month = page.components | nth(n=num_comps - 3) | int %}
39+
{%- set day = page.components | nth(n=num_comps - 2) | int %}
40+
{%- if loop.index0 == 0 %}
41+
{{ macros::show_year(year=year, post_name="Releases") }}
42+
{%- endif %}
43+
44+
{%- if page.extra is containing("release") %}
45+
{%- if loop.index0 != 0 %}
46+
{%- set prev_idx = loop.index0 - 1 %}
47+
{%- set prev_year = rev_pages[prev_idx].components | nth(n=num_comps - 4) | int %}
48+
{%- if prev_year != year %}
49+
{{ macros::show_year(year=year, post_name="Releases") }}
50+
{%- endif %}
51+
{%- endif %}
52+
{% if page.show_year %}<tr>
53+
<td class="bn"></td>
54+
<td class="bn"><h3 class="f0-l f1-m f2-s mt4 mb0">Posts in {{ year }}</h3></td>
55+
</tr>{% endif %}
56+
<tr>
57+
<td class="tr o-60 pr4 pr5-l bn">{{ macros::month_name(num=month) }}&nbsp;{{ day }}</td>
58+
<td class="bn"><a href="{{ config.base_url | safe }}{{ page.path | safe }}">{{ macros::escape_hbs(input=page.title) }}</a></td>
59+
</tr>
60+
{%- endif %}
61+
{%- endfor %}
62+
</table>
63+
</div>
64+
</section>
65+
{%- endblock page %}

0 commit comments

Comments
 (0)