From 97506d30f58265f1d5c9768ef5d612481d4ff090 Mon Sep 17 00:00:00 2001 From: Madelyn Olson Date: Mon, 16 Nov 2026 19:41:40 -0800 Subject: [PATCH 1/2] Put the download pages in the docs layout, under Getting started Download stays in the top bar, and the download pages now use the docs layout. In the docs menu, Download is a new entry at the end of Getting started, and it expands into one link per release line (9.2 down to 7.2) plus All releases. On any download page, Getting started is open and Download is marked current. On a release line page, or on a single release's page, that release line is marked current too. Signed-off-by: Madelyn Olson --- config.toml | 5 +++ sass/_valkey.scss | 5 +++ templates/download-layout.html | 23 +++++++++++++ templates/download.html | 6 ++-- templates/macros/nav.html | 61 ++++++++++++++++++++++++++++++++-- templates/release-line.html | 7 ++-- templates/release-page.html | 6 ++-- templates/release-section.html | 6 ++-- 8 files changed, 100 insertions(+), 19 deletions(-) create mode 100644 templates/download-layout.html diff --git a/config.toml b/config.toml index a1c598c0..cc36eb02 100644 --- a/config.toml +++ b/config.toml @@ -47,6 +47,11 @@ review_list = [ "/topics/distlock/" ] +# The docs menu's Download entry, with the release lines, goes at the end of +# this nav.yml section, which the download pages open. It goes at the start of +# the menu if there's no such section. +docs_menu_download_section = "getting-started" + # Labels shown next to menu entries from other sources, by source name. Only # modules get one; valkey-bundle isn't a module. [extra.nav_badges] diff --git a/sass/_valkey.scss b/sass/_valkey.scss index d0f2248c..44aa6dc6 100644 --- a/sass/_valkey.scss +++ b/sass/_valkey.scss @@ -728,6 +728,11 @@ p { } } + // The release lines under Download: laid out like commands, but not code. + .docs-menu-releases li a { + @include sans-serif; + } + // A badge on a section title, for a section that comes from a module. The // section titles are uppercase; the badge isn't. The margin keeps it away // from the arrow. diff --git a/templates/download-layout.html b/templates/download-layout.html new file mode 100644 index 00000000..81284c81 --- /dev/null +++ b/templates/download-layout.html @@ -0,0 +1,23 @@ +{% extends "left-aside.html" %} + +{#- The download pages: /download/, the release list, the release line pages + and each release. They use the documentation layout, with Download current + in the menu. -#} + +{% block related_content %} +{#- The release line of a line page (extra.version) or a release page (extra.tag). -#} +{% set download_line = "" %} +{% if page is defined and page.extra?.version %} + {% set download_line = page.extra.version %} +{% elif page is defined and page.extra?.tag %} + {% set download_line = (page.extra.tag | split(pat="."))[:2] | join(sep=".") %} +{% endif %} +{#- The same menu setup as docs.html and commands.html. #} +{% set nav_json %}{{< nav_merged extra={config.extra} />}}{% endset %} +{% set nav_data = load_data(literal=nav_json, format="json") %} +{% set nav_index_json %}{{< nav_command_index extra={config.extra} />}}{% endset %} +{% set nav_index = load_data(literal=nav_index_json, format="json") %} +{% set nav_map_json %}{{< nav_command_map nav={nav_data} index={nav_index} />}}{% endset %} +{% set nav_command_map = load_data(literal=nav_map_json, format="json") %} +{{< nav_menu nav={nav_data} extra={config.extra} command_map={nav_command_map} index={nav_index} download_path={current_path} download_line={download_line} />}} +{% endblock related_content %} diff --git a/templates/download.html b/templates/download.html index bffa1537..de1a471e 100644 --- a/templates/download.html +++ b/templates/download.html @@ -1,9 +1,7 @@ -{% extends "right-aside.html" %} +{% extends "download-layout.html" %} -{% block subhead_content%} -

Download Valkey

-{% endblock subhead_content%} {% block main_content %} +

Download Valkey

{# The newest stable release on each major.minor line, newest line first. #} {% set release_section = get_section(path="download/releases/_index.md") %} diff --git a/templates/macros/nav.html b/templates/macros/nav.html index ac397aad..1ad7af01 100644 --- a/templates/macros/nav.html +++ b/templates/macros/nav.html @@ -308,6 +308,53 @@ {% endcomponent nav_command_reference %} +{#- + The Download entry, with a toggle that lists each release line, newest + first, then all releases. The lines are the pages in + content/download/versions/, so a new line shows up once it has a page. + It's rendered after the topics of the section whose id is + extra.docs_menu_download_section in config.toml, or at the start of the + menu if there's none. + path: the current path on the download pages, "" elsewhere. There, + Download is current and its toggle is open. + line: the release line of the current page, e.g. "9.1", or "". + Like a current topic with commands, Download isn't a link on /download/ + itself: the whole row is the toggle. +-#} +{% component nav_download(path="", line="") %} +{%- set versions = get_section(path="download/versions/_index.md") -%} +{%- set_global keyed_lines = [] -%} +{%- for line_page in versions.pages -%} + {%- set parts = line_page.extra.version | split(pat=".") -%} + {%- set_global keyed_lines = [...keyed_lines, {"version": (parts[0] | int) * 1000 + (parts[1] | int), "page": line_page}] -%} +{%- endfor -%} +{%- set releases %} + +{%- endset %} +{%- if path == "/download/" %} +
  • +
    + Download + {{- releases | safe }} +
    +
  • +{%- else %} +
  • + Download +
    + Valkey versions + {{- releases | safe }} +
    +
  • +{%- endif %} +{% endcomponent nav_download %} + {#- The menu. current: slug of the current topic. @@ -322,16 +369,23 @@ index: from nav_command_index; used to list the command categories (groups) that have documented commands. on_command_reference: true on the command reference page. + download_path, download_line: see nav_download. download_path also + opens the section nav_download is rendered in. -#} -{% component nav_menu(nav, extra, current="", related="", open="", command_map={}, current_command="", index=[], on_command_reference=false) %} +{% component nav_menu(nav, extra, current="", related="", open="", command_map={}, current_command="", index=[], on_command_reference=false, download_path="", download_line="") %}