From a1d8677c6ccc367bcaa36aa51cd8257b8700e623 Mon Sep 17 00:00:00 2001 From: Remo Senekowitsch Date: Wed, 16 Apr 2025 16:46:04 +0200 Subject: [PATCH 1/4] Add /releases/latest redirect --- content/releases/_index.md | 3 +++ content/releases/latest.md | 3 +++ templates/latest.html | 8 ++++++++ 3 files changed, 14 insertions(+) create mode 100644 content/releases/_index.md create mode 100644 content/releases/latest.md create mode 100644 templates/latest.html diff --git a/content/releases/_index.md b/content/releases/_index.md new file mode 100644 index 000000000..800a24435 --- /dev/null +++ b/content/releases/_index.md @@ -0,0 +1,3 @@ ++++ +render = false ++++ diff --git a/content/releases/latest.md b/content/releases/latest.md new file mode 100644 index 000000000..f0b8daa56 --- /dev/null +++ b/content/releases/latest.md @@ -0,0 +1,3 @@ ++++ +template = "latest.html" ++++ diff --git a/templates/latest.html b/templates/latest.html new file mode 100644 index 000000000..ac88f7882 --- /dev/null +++ b/templates/latest.html @@ -0,0 +1,8 @@ +{% set section = get_section(path="_index.md") -%} +{%- for page in section.pages | reverse -%}{% if page.extra is containing("release") -%} + + +Redirect + +

Click here to be redirected to the latest Rust release annoucement.

+{% break %}{% endif %}{% endfor -%} From ca03de6b4f6e44e54dacdc5988d0de5fc71cebdd Mon Sep 17 00:00:00 2001 From: Remo Senekowitsch Date: Wed, 16 Apr 2025 17:22:39 +0200 Subject: [PATCH 2/4] Add /releases page --- content/releases/_index.md | 7 +++- templates/macros.html | 4 +-- templates/releases.html | 65 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+), 3 deletions(-) create mode 100644 templates/releases.html diff --git a/content/releases/_index.md b/content/releases/_index.md index 800a24435..43eb13702 100644 --- a/content/releases/_index.md +++ b/content/releases/_index.md @@ -1,3 +1,8 @@ +++ -render = false +title = "Rust Release Announcements" +template = "releases.html" +[extra] +index_title = "The Rust Release Announcements" +see_also_path = "/" +see_also_text = "the main Rust blog" +++ diff --git a/templates/macros.html b/templates/macros.html index c6713e5c2..816d2c43c 100644 --- a/templates/macros.html +++ b/templates/macros.html @@ -35,9 +35,9 @@ }} {%- endmacro escape_hbs %} -{% macro show_year(year) -%} +{% macro show_year(year, post_name="Posts") -%} -

Posts in {{ year }}

+

{{ post_name }} in {{ year }}

{%- endmacro show_year %} diff --git a/templates/releases.html b/templates/releases.html new file mode 100644 index 000000000..2d1da9c93 --- /dev/null +++ b/templates/releases.html @@ -0,0 +1,65 @@ +{% import "macros.html" as macros -%} +{% extends "layout.html" -%} +{% block page -%} +
+
+
+

+ This is a subset of the main Rust blog + listing only official release annoucement posts. +

+

+ Did you know? There are convenient redirects for + the latest and specific release posts: +
/releases/latest +
/releases/1.85.0 +

+
+
+
+
+

+ See also: + {{ section.extra.see_also_text }} +

+
+
+
+ +{% set section = get_section(path="_index.md") -%} +
+
+ + + {%- set rev_pages = section.pages | reverse %} + {%- for page in rev_pages %} + {%- set num_comps = page.components | length %} + {%- set year = page.components | nth(n=num_comps - 4) | int %} + {%- set month = page.components | nth(n=num_comps - 3) | int %} + {%- set day = page.components | nth(n=num_comps - 2) | int %} + {%- if loop.index0 == 0 %} + {{ macros::show_year(year=year, post_name="Releases") }} + {%- endif %} + + {%- if page.extra is containing("release") %} + {%- if loop.index0 != 0 %} + {%- set prev_idx = loop.index0 - 1 %} + {%- set prev_year = rev_pages[prev_idx].components | nth(n=num_comps - 4) | int %} + {%- if prev_year != year %} + {{ macros::show_year(year=year, post_name="Releases") }} + {%- endif %} + {%- endif %} + {% if page.show_year %} + + + {% endif %} + + + + + {%- endif %} + {%- endfor %} +

Posts in {{ year }}

{{ macros::month_name(num=month) }} {{ day }}{{ macros::escape_hbs(input=page.title) }}
+
+
+{%- endblock page %} From f0b858fd6428a08fb3c05bd04bf6dbdb22d8b65e Mon Sep 17 00:00:00 2001 From: Remo Senekowitsch Date: Wed, 16 Apr 2025 17:38:13 +0200 Subject: [PATCH 3/4] Point to /releases from main blog --- content/_index.md | 8 ++++++-- content/inside-rust/_index.md | 5 +++-- content/releases/_index.md | 5 +++-- templates/index.html | 5 ++++- templates/releases.html | 5 ++++- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/content/_index.md b/content/_index.md index 8088b0844..348474b7d 100644 --- a/content/_index.md +++ b/content/_index.md @@ -9,6 +9,10 @@ This is the main Rust blog. \ Rust teams \ use this blog to announce major developments in the world of Rust.""" maintained_by = "the Rust Teams" -see_also_path = "/inside-rust/" -see_also_text = """the "Inside Rust" blog""" +[[extra.see_also]] +path = "/inside-rust/" +text = """the "Inside Rust" blog""" +[[extra.see_also]] +path = "/releases/" +text = "release announcements" +++ diff --git a/content/inside-rust/_index.md b/content/inside-rust/_index.md index adb088406..9cf9438c9 100644 --- a/content/inside-rust/_index.md +++ b/content/inside-rust/_index.md @@ -11,6 +11,7 @@ to follow along with Rust development. The various \ use this blog to post status updates, calls for help, and other \ similar announcements.""" maintained_by = "the Rust Teams" -see_also_path = "/" -see_also_text = "the main Rust blog" +[[extra.see_also]] +path = "/" +text = "the main Rust blog" +++ diff --git a/content/releases/_index.md b/content/releases/_index.md index 43eb13702..a5434660b 100644 --- a/content/releases/_index.md +++ b/content/releases/_index.md @@ -3,6 +3,7 @@ title = "Rust Release Announcements" template = "releases.html" [extra] index_title = "The Rust Release Announcements" -see_also_path = "/" -see_also_text = "the main Rust blog" +[[extra.see_also]] +path = "/" +text = "the main Rust blog" +++ diff --git a/templates/index.html b/templates/index.html index 016f7ad23..786910b4e 100644 --- a/templates/index.html +++ b/templates/index.html @@ -11,7 +11,10 @@

See also: - {{ section.extra.see_also_text }} + {% for see_also in section.extra.see_also -%} + {% if loop.index0 != 0 %},{% endif %} + {{ see_also.text }} + {%- endfor -%}

diff --git a/templates/releases.html b/templates/releases.html index 2d1da9c93..6d789db5f 100644 --- a/templates/releases.html +++ b/templates/releases.html @@ -20,7 +20,10 @@

See also: - {{ section.extra.see_also_text }} + {% for see_also in section.extra.see_also -%} + {% if loop.index0 != 0 %},{% endif %} + {{ see_also.text }} + {%- endfor -%}

From 4c7b5982a8c584427debea0caf89db146dc986ac Mon Sep 17 00:00:00 2001 From: Remo Senekowitsch Date: Wed, 16 Apr 2025 17:54:56 +0200 Subject: [PATCH 4/4] Remove redundant backlink to main blog --- content/releases/_index.md | 3 --- templates/releases.html | 11 ----------- 2 files changed, 14 deletions(-) diff --git a/content/releases/_index.md b/content/releases/_index.md index a5434660b..e1b678eb2 100644 --- a/content/releases/_index.md +++ b/content/releases/_index.md @@ -3,7 +3,4 @@ title = "Rust Release Announcements" template = "releases.html" [extra] index_title = "The Rust Release Announcements" -[[extra.see_also]] -path = "/" -text = "the main Rust blog" +++ diff --git a/templates/releases.html b/templates/releases.html index 6d789db5f..fcfaa100b 100644 --- a/templates/releases.html +++ b/templates/releases.html @@ -16,17 +16,6 @@

-
-
-

- See also: - {% for see_also in section.extra.see_also -%} - {% if loop.index0 != 0 %},{% endif %} - {{ see_also.text }} - {%- endfor -%} -

-
-
{% set section = get_section(path="_index.md") -%}