Repository navigation
Address review feedback on site search - #3
Conversation
Topic and command pages show breadcrumbs from the documentation menu (nav.yml) since valkey-io#707, but search results gave them a breadcrumb made from the URL and the command's group, such as "Documentation › Command Reference › Server" for BGSAVE, whose page shows "Topics › Administration › Persistence". Both now come from the page's place in the menu, so a result's breadcrumb is the page's own without the page itself. Signed-off-by: notleowang <leo.wang@improving.com>
9. Breadcrumbs from the docs menuCommit: 0483680 Search breadcrumbs didn't match the docs breadcrumbs, which come from the documentation menu ( Topic and command pages already work out their place in the menu (
Commands that aren't in the menu fall back to Tested with a local build (Zola 0.23.6, Pagefind 1.6.0, current valkey-doc, valkey and modules): on all 87 topic pages and 459 command pages, the search breadcrumb equals the page's breadcrumb without its last item, and |
9a. - PreviewsCommit: 0483680 After (hosted locally via zola 0.23.6 and pagefind 1.6.0): Before (from Preview https://pr-723--valkey-preview.netlify.app/) |
Breadcrumbs for pages other than topics and commands came from a list of URL paths and labels in default.html, so adding a section or changing a breadcrumb meant changing template logic. Each section now sets its breadcrumb with `breadcrumb` in its [extra] front matter, and a page uses its own, or else the one of its nearest section that sets one. Every page's breadcrumb is unchanged. Signed-off-by: notleowang <leo.wang@improving.com>
The topic and command pages' search breadcrumbs start with "Topics", or "Commands" for commands that aren't in the docs menu, but the indexes themselves had "Documentation › Documentation by Topic" and "Documentation › Command Reference". They now have "Topics" and "Commands". Signed-off-by: notleowang <leo.wang@improving.com>
10. Breadcrumbs from front matter instead of template logicBreadcrumbs for pages other than topics and commands came from a list of URL paths and labels in [extra]
breadcrumb = "Blog"A page uses its own
The second commit changes the breadcrumbs of the topic and command indexes from "Documentation › Documentation by Topic" and "Documentation › Command Reference" to "Topics" and "Commands", the same as the start of their pages' breadcrumbs. TestingBuilt locally with Zola 0.23.6 and Pagefind 1.6.0, comparing every page's search breadcrumb between builds: |
Signed-off-by: notleowang <leo.wang@improving.com>
The release automation (update-valkey-website.yml in valkey-io/valkey-release-automation) rewrites content/try-valkey/_index.md from a fixed template on every Valkey release, which would drop its `breadcrumb` and leave the Try Valkey pages without one. Pages with no `breadcrumb` in their own or their sections' front matter now use the title of their nearest section other than the site's root. Try Valkey's section title is its breadcrumb, so its `breadcrumb` is removed and the file is again exactly what the automation writes. The automation isn't changed. Every page's breadcrumb is unchanged. Signed-off-by: notleowang <leo.wang@improving.com>
10. Follow-up: section title fallback for the release automationCommits: 5c6ca14 (merge of Problem found:The release automation ( So the Current workaround:Pages with no The automation's other step adds a new Testing
|
The modal's contents and Pagefind's result template were HTML strings in
search.js. They're now in templates/includes/search-modal.html, in a
<template> next to the search button's slot in default.html, which
search.js copies into the modal. A <template> keeps the Pagefind
elements inactive until they're in the modal, as the string-built one
did. It's outside .body, so Pagefind doesn't index it.
The result template is wrapped in {% raw %} ... {% endraw %}, which makes
Zola output its contents as written instead of rendering them. Pagefind's
placeholders ({{ meta.title }}, {{#if excerpt}}, {{+ excerpt +}}) use the
same braces as Zola's templates, so without it Zola would try to evaluate
them at build time and fail. No other template needs this; the only
other use in the repo is the 2024-11-21-testing-the-limits blog post,
which uses it to show Docker's {{.Names}} format string.
The modal's markup is unchanged.
Signed-off-by: notleowang <leo.wang@improving.com>
8. Search modal markup in a template instead of a JS stringCommit: c9e9d97 The modal's contents and Pagefind's result template were HTML strings in <div id="site-search"></div>
{% include "includes/search-modal.html" %}It's a
About
|
Closing search from further down a page scrolled back to the top. When the modal closes, Pagefind's modal trigger (handleModalClose in pagefind-modal-trigger.ts, the same in Pagefind 1.6.0 and its main branch) focuses the search button, and focusing it scrolls it into view. The header isn't sticky, so the button is at the top of the page. It only jumped when the button didn't already have focus, such as the first time search was closed after loading the page or after clicking in the page. Otherwise, the dialog returns focus to the button when it closes, which doesn't scroll, and Pagefind's focus does nothing. search.js now wraps the trigger's close handler and makes its focus not scroll. Pagefind's handler still runs, so focus still returns to the search button. Signed-off-by: notleowang <leo.wang@improving.com>
5. Closing search no longer scrolls to the topCommit: c11d3c8 CauseWhen the modal closes, Pagefind's modal trigger focuses the search button ( handleModalClose(): void {
if (this.buttonEl) {
this.buttonEl.setAttribute("aria-expanded", "false");
this.buttonEl.focus();
}
}
It only jumped when the button didn't already have focus: the first time search was closed after loading the page, or after clicking in the page. Otherwise, the dialog itself returns focus to the button when it closes, which by the HTML spec doesn't scroll, and Pagefind's Fix
Removing this patchThis is a workaround for Pagefind's behaviour, not something the site needs to keep. If Pagefind's To check after an upgrade: remove the wrapper, scroll down a long page, click in the page text, then open search with Cmd-K and close it with Esc. If the page stays where it was, the patch is no longer needed. Testing
|
1 and 3. Search button visibility and contrast: current measurementsNo changes yet. These are the current colours and contrast ratios of the search UI, to decide what to change. Method: computed styles from a built page ( Search button in the header
In Modal and results
Possible concerns
|
|
Continuing this thread in another PR. #4 |


Description
Changes for the review from @stockholmux on valkey-io#723, to be merged into
site-search.I will attempt to write my findings and describe the changes through comments under this PR.
Review items
Other
Inline-code items
Each item's changes are described in a comment, linked from the list above.
Note
The failing
assign-reviewerscheck is expected on this PR. It comes from upstream's Assign blog reviewers workflow, which runs because item 10 changescontent/blog/_index.md. It needs the Valkeyrie Bot app's secrets, which onlyvalkey-io/valkey-io.github.iohas, so in this fork it fails at "Generate token" (Input required and not supplied: app-id). Upstream on valkey-io#723 it has the secrets and skips, since no blog post is added.Project Scope
Upon looking at the requested changes, I have certain opinions on what can be addressed immediately without deviating out of scope or making big behavioral changes.
Check List
--signoff