Skip to content

Address more review feedback on site search - #4

Merged
notleowang merged 3 commits into
site-searchfrom
site-search-review-fixes
Nov 25, 2026
Merged

notleowang merged 3 commits into
site-searchfrom
site-search-review-fixes

Conversation

@notleowang

@notleowang notleowang commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Continues #3, with more changes for the review from @stockholmux on valkey-io#723, to be merged into site-search. #3 is merged, so this PR picks up the remaining items.

Review items

  • 1. The search button is easy to miss (compact trigger, grey-on-grey) (measurements) (changes)
  • 2. Search analytics (hits and misses), or a way to add them
  • 3. Contrast of the grey-on-grey and light text (measurements) (changes)
  • 4. A search page, or a way to start a search from the URL
  • 6. Boosting topics in results, and leaving topics out of the index (changes)
  • 7. Keeping design, templates, content and code separate

Done in #3: 5 (closing search scrolls to the top), 8 (result template in a JS string), 9 and 10 (breadcrumbs).

Each item's changes are described in a comment, linked from the list above.

Check List

  • Commits are signed per the DCO using --signoff

The search button had no visible text, only Pagefind's icon and the
keyboard shortcut, in grey on a fill and border that barely differ from
the header. It now shows "Search", which Pagefind leaves out in compact
mode. Pagefind's default label is its lowercase "search" keyboard hint,
so the label is set explicitly.

The label and icon use the GitHub button's text colour, valkey-io#444 (9.24:1 on
the button's #f8f9fa). Pagefind's #767676 is 4.31:1 there, below the
4.5:1 that text needs. Only the button is affected; the modal keeps
Pagefind's colours.

From 1025px to 1100px, just above the mobile menu, the nav doesn't fit
the label and the shortcut, so the shortcut is hidden there, as on touch
devices. The shortcut still works. In the mobile menu, the label is
centred like the GitHub button's.

Signed-off-by: notleowang <leo.wang@improving.com>
The search button now sits between the nav links and the GitHub button,
so it's next to the other links rather than at the end of the header. In
the mobile menu, it's above the GitHub button. The keyboard order
follows the visual order.

Signed-off-by: notleowang <leo.wang@improving.com>
@notleowang

Copy link
Copy Markdown
Collaborator Author

1 and 3. Search label, contrast and position

Commits: a8d130b, ca967b3

  • Visible label: the search button shows "Search", instead of only an icon and the shortcut. Pagefind leaves the label out in compact mode, which the button used before. Its default label is the lowercase "search" keyboard hint, so the label is set explicitly.
  • Contrast: the label and icon use the GitHub button's text colour, #444, at 9.24:1 on the button's #f8f9fa. Pagefind's #767676 would be 4.31:1 there, below the 4.5:1 that text needs. Only the button is affected; the modal keeps Pagefind's colours, which pass on its white background (see the measurements).
  • Narrow desktop widths: from 1025px to 1100px, just above the mobile menu, the nav doesn't fit the label and the shortcut, so the shortcut keys are hidden there, as on touch devices. The shortcut still works.
  • Mobile menu: the label is centred, like the GitHub button's.
  • Position: the search button is now between the nav links and the GitHub button, and above the GitHub button in the mobile menu. The keyboard order follows the visual order.

Testing

Checked in headless Chrome with the built site, and locally in the browser:

  • The button fits the header with its usual 20px margin at every width tested from 1025px to 1440px, and the header stays 81px tall (nothing wraps). The button is 96px wide without the shortcut keys (1025–1100px) and 155px with them.
  • Label and icon contrast: 9.24:1, the same as the GitHub button's text.
  • Mobile menu (500px): the search button is full width and centred, above the GitHub button.
  • build/check-search-index.py: 795 pages indexed, 0 problems.

@notleowang

notleowang commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator Author

1 and 3. Follow-up & My Suggestions

Header layout ideas, outside this PR

While working on the search button, two header ideas came up. They change the existing header design, so I've kept them out of this PR and am suggesting them for a later change:

  • A smaller GitHub button. It could show only the GitHub icon and star count ("27.9k ★"), or only the icon. That would free up header space, so the search shortcut wouldn't need to be hidden at narrower desktop widths, and the search bar would stand out more. The star count was added on purpose in feat: Add GitHub button to navigation bar valkey-io/valkey-io.github.io#291, so the icon-and-count option keeps it. An icon-only link would also need an accessible label such as aria-label="GitHub".
  • Search before the nav links. Search would be the first item in the mobile menu instead of near the bottom, and would be seen sooner on desktop. The trade-off is that the bordered search and GitHub buttons would no longer sit together on desktop. Since the mobile menu uses the same order as desktop, both would move together.

These may be worth considering together, since a smaller GitHub button would also make the search bar's position stand out more. Happy to try either in a follow-up if they sound useful.

@notleowang notleowang mentioned this pull request Nov 24, 2026
5 of 11 tasks
@notleowang
notleowang marked this pull request as ready for review November 24, 2026 22:00
@notleowang notleowang self-assigned this Nov 24, 2026
Searching "migration" showed "Migration from Redis to Valkey" third,
behind the atomic slot migration blog post and topic, which mention the
word more.

Each [[boost]] in _data/search.toml gives a page's URL and the keywords
it should rank higher for. default.html adds the page's keywords as
Pagefind metadata, and search.js gives that field a weight of 10 with
Pagefind's metaWeights, twice its default title boost. The boost only
applies to searches matching the keywords, and pages titled exactly
what was searched still come first.

The boosts are in a file rather than front matter because docs topics
and commands come from other repositories; the file works for any page.
A boost is keyed by URL, so it needs updating if its page moves.

/topics/migration/ is boosted for "migration", and a ranking case checks
that it's the first result.

Signed-off-by: notleowang <leo.wang@improving.com>
@notleowang

Copy link
Copy Markdown
Collaborator Author

6. Boosting pages in search

Commit: dd3da60

Searching "migration" showed Migration from Redis to Valkey third, behind the atomic slot migration blog post and topic, which mention the word more often.

  • New file _data/search.toml: each [[boost]] gives a page's URL and the keywords it should rank higher for:
    [[boost]]
    url = "/topics/migration/"
    keywords = ["migration"]
  • How it works: default.html adds the page's keywords as Pagefind metadata, and search.js gives that field a weight of 10 using Pagefind's metaWeights. That's twice Pagefind's default boost for title matches.
  • It's limited to the keywords. The boost only applies to searches that match them, so the page doesn't move up in unrelated results. Pages titled exactly what was searched still come first: "migrate" still shows the MIGRATE command first.
  • Why a file, not front matter: docs topics and command pages come from other repositories (valkey-doc and the command JSON), so this repo can't set front matter on them. The file works for any page. Since a boost is keyed by URL, it needs updating if its page moves.
Search "migration" Before After
Migration from Redis to Valkey 3rd (14.6) 1st (39.6)
Resharding, Reimagined: Introducing Atomic Slot Migration (blog) 1st (19.7) 2nd (19.7)
Atomic slot migration (topic) 2nd (14.7) 3rd (14.7)

Related, not implemented here

  • Leaving a page out of search: possible by excluding the page's content from the index, as the site already does for the 404 page. I tested it on a local build, and the page no longer appeared in any results.
  • Ranking a page lower: Pagefind can also give a page's content a weight below normal, which would push it down. It isn't used here, since boosting the migration page already puts it above the blog post.

Testing

  • A new ranking case checks that "migration" shows /topics/migration/ first. With the keyword weight set to 0, the case fails ("shows /blog/atomic-slot-migration/"), so it would catch the boost breaking.
  • All 25 ranking cases pass, and the existing 24 are unaffected, since only pages listed in the file get keywords. Weights of 3, 5 and 10 all kept the existing cases passing. 10 gives the clearest margin (about 2×).
  • build/check-search-index.py: 795 pages indexed, 0 problems.

@notleowang
notleowang merged commit e853bdf into site-search Nov 25, 2026
@notleowang
notleowang deleted the site-search-review-fixes branch November 26, 2026 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant