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 new file mode 100644 index 000000000..e1b678eb2 --- /dev/null +++ b/content/releases/_index.md @@ -0,0 +1,6 @@ ++++ +title = "Rust Release Announcements" +template = "releases.html" +[extra] +index_title = "The Rust Release Announcements" ++++ 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/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/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 -%} 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..fcfaa100b --- /dev/null +++ b/templates/releases.html @@ -0,0 +1,57 @@ +{% 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 +

+
+
+
+ +{% 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 %}