Skip to content

ux: "Did you mean" suggestions in the empty search state, reusing the 404 page's closest-match logic #109

Closed

Description

@TMHSDigital

Why it matters
A typo ("quaternious", "kenny") shows an empty result list and a "Clear filters" button. The 404 page already solves this: it suggests the closest entries by name. Zero-result searches are the moment a visitor leaves, and the fix is a function call away.

Evidence

  • site/lib/search.mjs exports closestEntries, used by site/public/not-found.js.
  • site/public/app.js renders #empty-state without suggestions.

Suggested approach
When results are empty and the query is non-empty, call closestEntries(query, entries, 5) and render "Did you mean: Quaternius, ..." as buttons that set the search box. Add a test in lib.test.mjs for a misspelt publisher.

Done when
A misspelt search shows up to five clickable suggestions, and clicking one runs that search.

Activity

  1. TMHSDigital commented on Oct 22, 2026

    @TMHSDigital
    OwnerAuthor

    Resolved by #124, merged to main in 1e1cfb8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions