From 48753b6726545698a3efbe57b0472e66d158e25c Mon Sep 17 00:00:00 2001 From: Madelyn Olson Date: Mon, 16 Nov 2026 19:07:13 -0800 Subject: [PATCH 1/3] Keep the docs menu in view and add previous/next topic links On valkey.io the docs menu scrolls away with the page. On a long topic like /topics/replication/ that leaves about 10,700px of empty lavender column, and on phones the menu is rendered after the content, 27,948px down a 30,850px page. Neon's docs keep the menu stuck in view with its own scroll. This PR does the same: on wide screens the menu sticks to the top of the window and scrolls on its own, jumping to the current entry if it starts out of view, and on narrow screens it moves above the content as a closed "Documentation menu" toggle. Three other options are in the details. A docs topic page ends with no way to keep reading, so a reader working through the docs goes back to the menu after every page. This adds Previous and Next links at the end of each topic, in the order the docs menu lists them, crossing from the end of one section into the start of the next. Command pages don't get them. Topic and command pages also get a "#" link on each heading for linking to a section, and, on command pages, the "Update this Page on GitHub" link that topic pages already have. Before on the left, after on the right, at 1440x900. /topics/ top: /topics/ halfway: /topics/replication/ halfway: /topics/replication/ at the end of the article: /commands/set/ 40% down: /commands/zunionstore/ on load: /topics/replication/ at 390px wide: before, after, and after with the toggle opened. **Previous and next links** First topic (introduction), before and after: ![before](https://raw.githubusercontent.com/madolson/valkey-io.github.io/389342921d912200ffe5a61726647a2b8bcbb581/valkey-io-valkey-io.github.io-docs-prev-next/before-first.png) ![after](https://raw.githubusercontent.com/madolson/valkey-io.github.io/389342921d912200ffe5a61726647a2b8bcbb581/valkey-io-valkey-io.github.io-docs-prev-next/after-first.png) Middle topic (large-object-getting-started), before and after: ![before](https://raw.githubusercontent.com/madolson/valkey-io.github.io/389342921d912200ffe5a61726647a2b8bcbb581/valkey-io-valkey-io.github.io-docs-prev-next/before-middle.png) ![after](https://raw.githubusercontent.com/madolson/valkey-io.github.io/389342921d912200ffe5a61726647a2b8bcbb581/valkey-io-valkey-io.github.io-docs-prev-next/after-middle.png) Last topic (history), before and after: ![before](https://raw.githubusercontent.com/madolson/valkey-io.github.io/389342921d912200ffe5a61726647a2b8bcbb581/valkey-io-valkey-io.github.io-docs-prev-next/before-last.png) ![after](https://raw.githubusercontent.com/madolson/valkey-io.github.io/389342921d912200ffe5a61726647a2b8bcbb581/valkey-io-valkey-io.github.io-docs-prev-next/after-last.png) 390px wide, before and after: ![before](https://raw.githubusercontent.com/madolson/valkey-io.github.io/389342921d912200ffe5a61726647a2b8bcbb581/valkey-io-valkey-io.github.io-docs-prev-next/before-mobile.png) ![after](https://raw.githubusercontent.com/madolson/valkey-io.github.io/389342921d912200ffe5a61726647a2b8bcbb581/valkey-io-valkey-io.github.io-docs-prev-next/after-mobile.png) **Heading links, Edit on GitHub** /topics/replication/ heading while hovered, before and after, then reached with Tab: ![before](https://raw.githubusercontent.com/madolson/valkey-io.github.io/c298960997e7dded791e71bef1afc0df2690ebd8/valkey-io-valkey-io.github.io-docs-small-extras/before-topic-heading-hover.png) ![after](https://raw.githubusercontent.com/madolson/valkey-io.github.io/c298960997e7dded791e71bef1afc0df2690ebd8/valkey-io-valkey-io.github.io-docs-small-extras/after-topic-heading-hover.png) ![after, keyboard focus](https://raw.githubusercontent.com/madolson/valkey-io.github.io/c298960997e7dded791e71bef1afc0df2690ebd8/valkey-io-valkey-io.github.io-docs-small-extras/after-topic-heading-focus.png) /commands/set/ end of the docs menu, before and after: Signed-off-by: Madelyn Olson --- sass/_valkey.scss | 142 ++++++++++++++++++++++++++++++++++++ templates/command-page.html | 12 ++- templates/docs-page.html | 13 ++-- templates/left-aside.html | 28 ++++++- templates/macros/docs.html | 9 +++ templates/macros/nav.html | 35 +++++++++ 6 files changed, 228 insertions(+), 11 deletions(-) diff --git a/sass/_valkey.scss b/sass/_valkey.scss index d0f2248c..5c2690f6 100644 --- a/sass/_valkey.scss +++ b/sass/_valkey.scss @@ -584,6 +584,76 @@ p { } } } + + // The docs menu (templates/left-aside.html) goes above the page on narrow + // screens. On wide screens .docs-sidebar has the padding instead. + .docs-aside { + order: -1; + + @include respond-min(1024px) { + order: 0; + padding: 0; + } + } +} + +// Narrow screens: a toggle that opens the menu. Wide screens: the menu sticks +// to the top of the window, at most a window tall, and scrolls on its own. +.docs-sidebar { + > summary { + display: flex; + justify-content: space-between; + align-items: center; + padding: 1rem 1.6rem; + border-radius: 10px; + background-color: #fff; + font-weight: 700; + color: #000; + cursor: pointer; + list-style: none; + + &::-webkit-details-marker { + display: none; + } + + // Chevron, as in the menu's sections. + &::after { + content: ''; + width: 0.7rem; + height: 0.7rem; + border-right: 2px solid currentColor; + border-bottom: 2px solid currentColor; + transform: rotate(-45deg); + } + + &:focus-visible { + outline: 2px solid #2054B2; + outline-offset: 1px; + } + } + + &[open] > summary { + margin-bottom: 1rem; + + &::after { + transform: rotate(45deg); + } + } + + @include respond-min(1024px) { + position: sticky; + top: 0; + max-height: 100vh; + overflow-y: auto; + overscroll-behavior: contain; + scrollbar-width: thin; + scrollbar-color: #c5cdea transparent; + padding: 2rem; + + > summary { + display: none; + } + } } .docs-menu { @@ -2140,6 +2210,24 @@ html.banner-hidden .banner { height: 1.6rem; } +// "#" after each docs heading (heading_links in templates/macros/docs.html). +// Shown while the heading is hovered or the link has focus, and always on +// touch screens, which can't hover. +.heading-link { + margin-left: 0.4em; + opacity: 0; + + h2:hover > &, + h3:hover > &, + &:focus { + opacity: 1; + } + + @media (hover: none) { + opacity: 1; + } +} + // Amber rather than red: a release candidate is not broken, it is just not // finished. #7A4A00 on #FFF6E5 is 7.4:1. .release-prerelease-notice { @@ -2410,6 +2498,60 @@ blockquote { margin: 1.5rem 0 2.5rem; } +// Previous and next topic links at the end of a topic (nav_pager in +// templates/macros/nav.html). The links look like the docs menu's. "Next" +// stays on the right when there's no "Previous". +.docs-pager { + display: flex; + justify-content: space-between; + gap: 1rem; + margin-top: 4rem; + padding-top: 1.5rem; + border-top: 1px solid #d5d9ec; + + a { + display: flex; + flex-direction: column; + max-width: 50%; + padding: 0.6rem 1rem; + border-radius: 4px; + line-height: 1.35; + + &:hover { + background-color: #d1d9ff; + } + + &:focus-visible { + outline: 2px solid #2054B2; + outline-offset: 1px; + } + } + + .docs-pager-next { + margin-left: auto; + align-items: flex-end; + text-align: right; + } + + .docs-pager-label { + font-size: 1.3rem; + color: #444; + } + + .docs-pager-title { + font-weight: 600; + } + + @media (max-width: 768px) { + flex-direction: column; + gap: 0.5rem; + + a { + max-width: none; + } + } +} + // Homepage blog cards: text-only cards stacked vertically, matching the release // cards in the other column. .homepage-blog-section { diff --git a/templates/command-page.html b/templates/command-page.html index f1da74f7..8b1ca83a 100644 --- a/templates/command-page.html +++ b/templates/command-page.html @@ -166,13 +166,14 @@

{{ command_title }} {% if deprecated %} {{ de {% if command_description %} {%- set command_description_with_fixed_links %}{{< fix_links_command content={command_description} />}}{% endset -%} +{%- set command_description_html %}{{ command_description_with_fixed_links | markdown | safe }}{% endset -%} -{{ command_description_with_fixed_links | markdown | safe }} +{{< heading_links content={command_description_html} />}} {% else %} ERROR. Command description not loaded
{% endif %} {% if command_data_obj.replaced_by %} -

Deprecation advice

+{{< heading_links content='

Deprecation advice

' />}} Instead of using {{ command_title }} use
{{ command_data_obj.replaced_by | markdown | safe }}
{% endif %} @@ -205,7 +206,7 @@

RESP3 Reply

{% endif -%} {% if command_data_obj and command_data_obj.history %} -

History

+{{< heading_links content='

History

' />}} @@ -225,6 +226,11 @@

History

{% endif %} +{# Every command page, module commands included, is built from a description in valkey-doc (see build/init-commands.sh). #} +
+ See an error? + Update this Page on GitHub! +
{% endblock main_content %} {% block related_content %} diff --git a/templates/docs-page.html b/templates/docs-page.html index 748c0c16..8cb1cc83 100644 --- a/templates/docs-page.html +++ b/templates/docs-page.html @@ -59,7 +59,13 @@

{{ frontmatter_title }}


{% endif %} {%- set content_with_fixed_links %}{{< fix_links_docs content={page_contents} />}}{% endset -%} -{{ content_with_fixed_links | markdown | safe }} +{%- set content_html %}{{ content_with_fixed_links | markdown | safe }}{% endset -%} +{{< heading_links content={content_html} />}} +
+ See an error? + Update this Page on GitHub! +
+{{< nav_pager nav={nav_data} slug={page.slug} extra={config.extra} />}} {% endblock main_content %} {% block related_content %} @@ -68,9 +74,4 @@

{{ frontmatter_title }}

{% 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} current={page.slug} open={nav_location.section} command_map={nav_command_map} index={nav_index} />}} - -
- See an error? - Update this Page on GitHub! -
{% endblock related_content %} diff --git a/templates/left-aside.html b/templates/left-aside.html index 8ec70914..1089f29f 100644 --- a/templates/left-aside.html +++ b/templates/left-aside.html @@ -10,8 +10,32 @@ {% block main_content %}{% endblock main_content %} - From 498eb78e2d6aa1ca7852897b86343cc00f4f1938 Mon Sep 17 00:00:00 2001 From: Madelyn Olson Date: Mon, 23 Nov 2026 11:59:37 -0800 Subject: [PATCH 3/3] Close the docs menu when the window narrows Signed-off-by: Madelyn Olson --- templates/left-aside.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/left-aside.html b/templates/left-aside.html index 9b576308..5ff2ccbb 100644 --- a/templates/left-aside.html +++ b/templates/left-aside.html @@ -23,7 +23,7 @@ var wide = window.matchMedia('(min-width: 1024px)'); sidebar.open = wide.matches; wide.addEventListener('change', function () { - if (wide.matches) sidebar.open = true; + sidebar.open = wide.matches; }); })();