Repository navigation
Conversation
The docs menu scrolled away with the page, leaving an empty column next to long topic and command pages. On wide screens it now sticks to the top of the window, at most a window tall, and scrolls on its own. If the current page's entry starts out of view, the menu scrolls to it. On narrow screens the menu came after the page content, so it was at the bottom of long pages. It now sits above the content as a closed "Documentation menu" toggle. Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
Each h2 and h3 in the docs content gets a "#" link to itself, shown while the heading is hovered or the link has focus, and always on touch screens. Zola's insert_anchor_links doesn't apply to the markdown filter the templates use, so heading_links adds the links to the rendered HTML. The History and Deprecation advice headings on command pages get them too; History gets an id for it. Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
copy-code.js wraps each code block in the docs content and adds the same button as the release pages' .copy-code blocks, so the existing click handler does the copying and announces it. The button sits in the block's top right corner, in colors for the dark code theme. Blocks that are already .copy-code are skipped. Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
Topic pages link to their valkey-doc source below the docs menu. Command pages now do the same. Every command page, module commands included, is built from a description in valkey-doc's commands/ directory (build/init-commands.sh), so the link always points there. Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
Reverts f9ac5e3. Many docs code blocks mix commands with prompts and replies, so copying a whole block grabs text that can't be pasted and run. Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
On narrow screens the menu is a closed toggle, which hid "Update this Page on GitHub" on topic and command pages. It now ends the content, above the previous and next links, on every screen size. nav_pager found the current topic with five set_global variables. It now finds its index with a comprehension and needs set_global only to build the reading order. Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
Owner
Author
|
Promoted upstream: valkey-io#773 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
Middle topic (large-object-getting-started), before and after:
Last topic (history), before and after:
390px wide, before and after:
Heading links, Edit on GitHub
/topics/replication/ heading while hovered, before and after, then reached with Tab:
/commands/set/ end of the docs menu, before and after:
AI generated details
Neon vs valkey.io
Computed styles from headless Chrome at 1440x900, on https://neon.com/docs/introduction/branching and https://valkey.io/topics/replication/.
position: relative, 81px, scrolls awayposition: sticky; top: 60pxheight: calc(100vh - 3.75rem); overflow-y: scroll, scrollbar hidden<details>, only the current one openaria-currentaria-current="page"Options
templates/default.htmland.header, which Route /docs/ to the topics index and link Clients and Integrations in the docs menu valkey-io/valkey-io.github.io#742 also edits. Can go on top of 1 later by changingtop.markdownfilter in the template, so there's nopage.toc. It needs JS that builds the list from headings and a third column, which narrows content from 940px to about 700px at 1440px. Good next stage.sass/_valkey.scss.For narrow screens, Neon's fixed bottom bar with a drawer loses to a
<details>toggle: it adds a fixed overlay and more JS for the same result.Why it happens
templates/left-aside.html:13-15(main) puts the aside aftermain.sass/_valkey.scss:509lays them out as a column below 1024px, so the menu lands after the content, and:516usesrow-reverseabove it. The aside rule atsass/_valkey.scss:552has no positioning.Change
templates/left-aside.html:13-39: the aside's content is wrapped in<details class="docs-sidebar" open>. An inline script closes it below 1024px, reopens it when the window widens, and on wide screens scrolls the menu (not the page) when the current entry (.docs-menu-current, else.docs-menu-related) starts below the visible part.sass/_valkey.scss:588-597:.left-aside .docs-asidegetsorder: -1below 1024px so the menu sits abovemain. At 1024px and up it hands its padding to the sticky panel.sass/_valkey.scss:602-657: the summary is a white toggle bar on narrow screens. At 1024px and up:position: sticky; top: 0; max-height: 100vh; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin, summary hidden.<details>stays open: desktop is unchanged, narrow screens show the open menu above the content.left-aside.htmlchange (docs, docs-page, commands, command-page).templates/blog-aside.htmlalso uses.left-asideand is unaffected..right-styled asideis alreadyposition: sticky; top: 0; height: 100vh(sass/_valkey.scss:806-818on main).Decisions
mainin the DOM, so keyboard and screen reader users reach it after the content. Desktop already works this way (row-reverse). Proposal: keep. Moving the aside first in the DOM changes tab order on every docs page.Overlaps
.docs-menu-linkatsass/_valkey.scss:649and editstemplates/macros/nav.html. This PR's hunk ends at line 589, so they merge cleanly, and the new links render inside the sticky panel.sass/_valkey.scsshunks are at lines 299, 321 and 1079 onward. No overlap.templates/default.html.Testing
Only checked in headless Chrome. Safari and Firefox are unverified. Safari before 18.2 ignores
scrollbar-width.Previous and next links (from #27)
Decisions
Order is the menu's. Each section's landing page (the menu's "Overview"), then its topics, section after section. It's computed from the same
nav_mergedresult the menu is rendered from (templates/docs-page.html:20), so module sections (Search, Large object) and module topics (bloomfilters, valkey-json, ldap, valkey-bundle) land where the menu shows them, and the two can't drift apart.Section boundaries: cross. Stopping would dead-end the last page of 13 of the 14 sections. The breadcrumb already says which section you're in. Docusaurus, MkDocs Material and VitePress all cross without marking it.
Command reference: skipped. It's a list of 457 commands, not a page you read next. After valkey-bundle (end of Getting started) comes data-types. The Clients, Integrations and Valkey Admin menu links from valkey-io#742 come from config, not
nav_merged, so they're skipped too.First and last pages. introduction shows only Next, history only Previous. No wrap-around. Next stays on the right when it's alone.
Command pages: none. 457 pages with no reading order: alphabetical puts APPEND between ACL WHOAMI and ASKING. Someone on a command page is looking it up, not reading through, and the breadcrumb and the menu's command list under the related topic already link the topic and its sibling commands.
Titles are the topic's own front matter title, the same as its H1, not the shorter menu title. Menu titles like "Getting started" and "Configuration" (Large object, Search) only make sense under their section heading.
Topic not in the menu: no links, and its would-be neighbours skip it. Today all 84 topics are in the menu.
Implementation
nav_pagercomponent,templates/macros/nav.html:230-271: flattens the menu, finds the page, renders the links. Called once at the end of the content,templates/docs-page.html:63..docs-pager,sass/_valkey.scss:2413-2464. Inside the content card under a 1px#d5d9ecrule (the menu's section divider). Padding, radius,#d1d9ffhover and#2054B2focus outline are the menu links'. The label is#444, like the topic index descriptions. No new colors. Stacks below 768px.rel="prev"andrel="next"; the block is a<nav aria-label="Previous and next topics">.Testing
A Python script recomputes the order from
nav.ymlandmodules-nav/*.ymlindependently of the templates, and checks the hrefs on every built page:With
faqremoved from a scratch copy ofnav.yml: faq has no pager and installation's Next is migration. Also built merged with valkey-io#742: same 84 of 84.Not verified: hover and focus states visually (static headless screenshots only), and screen reader output.
Overlaps
left-aside.html,.docs-asidestyles) and Route /docs/ to the topics index and link Clients and Integrations in the docs menu valkey-io/valkey-io.github.io#742 (nav_menu,.docs-menu-link) both merge cleanly with this branch.docs-page.htmlaround the markdown line (62), this PR's one added line next to it will conflict trivially.For you to decide
Heading links, Edit on GitHub
Heading links
Template-side, no JS. Zola's
insert_anchor_linksonly reachespage.content. Topics and command descriptions go through themarkdownfilter (templates/docs-page.html:62,templates/command-page.html:169), which ignores it: with[markdown] insert_anchor_links = "right"inconfig.toml, blog posts get anchors and /topics/replication/ and /commands/set/ get none. Soheading_links(templates/macros/docs.html:63-71) rewrites the rendered HTML withregex_replace, appending<a class="heading-link" href="#id" aria-label="Link to this section">#</a>inside each<h2 id>and<h3 id>. The links work without JS and nothing shifts on load.Scope. h2 and h3 in topic bodies and command descriptions, plus the template's "Deprecation advice" and "History" headings (
templates/command-page.html:176,209). History had no id and now hasid="history"; no command doc has a History heading of its own. h1 and h4 are left alone. All 2,372 content h2/h3 get a link to their own id. Apart from those links, the new id, the command Edit links and whitespace, the built pages are unchanged, and every code block is byte-identical.Visibility (
sass/_valkey.scss:2240-2256).opacity: 0until the heading is hovered or the link has focus, so the link stays in the tab order, whichvisibility: hiddenwould not. Always shown on(hover: none)screens, which can't hover.Accessible name. "Link to this section". The link sits inside the heading, so a screen reader's headings list reads "How Valkey replication works Link to this section". Zola's own anchors, VitePress and Docusaurus make the same tradeoff. Putting the link after the heading instead, as GitHub does, needs a wrapper around every heading, which breaks the
.main-inner > h2margins (sass/_valkey.scss:531). Proposal: keep.Copy buttons on code blocks were dropped (c8d7631): blocks mix commands with prompts and replies, so copying a whole block grabs text that can't be run.
Edit on GitHub
Same markup and text as on topic pages. On both, it ends the page content, above the previous and next links (
templates/docs-page.html:64-67,templates/command-page.html:230-233), so the closed menu toggle on phones doesn't hide it. It points athttps://github.com/valkey-io/valkey-doc/edit/main/commands/<slug>.md.Module commands link to valkey-doc too. Their descriptions live there, not in the module repos:
build/init-commands.sh:83creates a page only for eachvalkey-doc/commands/*.md, and valkey and the module repos supply only the JSON metadata (syntax, complexity, history). All 457 pages,bf.*,json.*,ft.*andblob.*included, have a valkey-doc file.For you to decide
valkey/src/commands/<name>.jsonor the module repo's)? Proposal: no. Readers report errors in the description, and the generated stub already names the JSON's repo.Overlaps
docs-page.htmlconflicted on the markdown line, as Link the previous and next topic at the end of each docs topic #27 predicted. Resolved by keeping both, heading links thennav_pager(templates/docs-page.html:62-64).templates/macros/nav.html, untouched here.Testing
Scripted in headless Chrome over CDP against
zola serveof this branch, all passing:location.hashto the heading's id. Hover shows the link, moving away hides it, click sets the hash.maintree (GitHub API). HEAD on 42blob/mainURLs (17 picked core and module commands, 25 random): all 200, and a made-updoesnotexist.mdis 404. The/edit/URLs themselves answer 302 to login for anonymous requests whether or not the file exists, so they can't be checked directly.Not verified: Safari and Firefox, screen reader output.
This was generated by AI but verified, with love, by a human.