Skip to content

Rebuild the docs site with working search and a structure organised by reader - #19

Merged
Mistium merged 12 commits into
masterfrom
docs-rework
Nov 1, 2026
Merged

Mistium merged 12 commits into
masterfrom
docs-rework

Conversation

@Mistium

@Mistium Mistium commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

A ground-up rebuild of the docs site. The old one was hard to read through and search didn't work at all: it pointed at an Algolia index that doesn't exist ("Index mistwarp does not exist"). Stacked on #18.

Search that works. Pagefind builds the index during docusaurus build, with no outside service, so it works offline and inside the editor's Help window. Results group matching headings under each page and link straight to them. When a query has no exact match it retries with prefixes and labels the results as close matches: "packger" finds the packager pages. Ctrl/Cmd+K and / open it. Inside the Help window, Ctrl/Cmd+K still goes to the editor's spotlight. The dialog is keyboard navigable, traps focus, and announces result counts to screen readers. The first query loads about 120 KB, later ones 1 to 40 KB.

Organised by reader, not by folder. Five sections, each with an overview page: Using MistWarp, Extensions, Packager, Contributing and Backend. Sidebars are written out in sidebars.js instead of generated from folder names. There's a real landing page with search and a card per section.

Merged and removed. The two VM API pages are one page now, and so are the two utility pages. The extension "Scratch object" page moved into the Extension API page, and the editor tour, custom blocks and packaging pages joined the pages that cover them. Stub pages are gone. Titles are in sentence case. Turbo mode now has a real explanation (it was described as a setting, which was wrong).

Readable. Comfortable line length and type scale, a visible "On this page", prev and next links, and readable tables and code. Every text colour is at least 4.5:1 contrast in both themes, standalone and inside the Help window; the lowest is 4.74. Notes use a tinted background and an icon, with no side stripes. Standalone visitors get a colour mode switch, hidden when embedded.

Nothing breaks.

  • Links: every page the old site served still exists, and every docs link in scratch-gui still resolves, through a redirect where a page moved. npm run check (scripts/check-inbound-links.mjs) checks all 150 inbound paths, anchors included, against the build and a scratch-gui checkout, and CI runs it.
  • Deploy: scripts/pack-build.mjs, baseUrl: '/docs/' and trailingSlash are unchanged, so the tarball scratch-gui's Cloudflare build downloads keeps its shape.
  • Help window: it still follows the editor's theme. The site also honours ?docusaurus-theme=dark|light, which the Help window can use instead of writing localStorage.theme in a follow-up.

AGENTS.md tells coding agents where pages go, the writing rules and the URL contract.

Before After
Old landing page New landing page
Old reference page New reference page
Old search, which returned nothing New search results

A typo falls back to close matches:

Search for packger showing close matches

Phone width, dark:

Landing page on a phone Reference page on a phone

Inside the editor's Help window (880 px, editor dark theme), searching:

Search inside the Help window

Checks: npm run build (broken links, anchors and Markdown links fail the build) and npm run check pass. Chromium and Firefox at 1280 and 390, light and dark, plus a Help window harness. An independent review checked the URL contract, deploy, Help window, search, contrast and content, and its findings are all addressed.

@Mistium
Mistium changed the base branch from master to backend-docs November 1, 2026 03:37
Merge the duplicate VM, extension and utility API pages into the API
reference, fold the editor tour, custom blocks and packaging pages into
their canonical pages, delete the moved stubs, and add overview pages for
Advanced features and the community site. Every old path redirects.
The index is written by a local plugin after docusaurus build, so it needs
no external service and works offline and inside the editor's Help window.
Ctrl or Cmd+K and / open it, except that Ctrl or Cmd+K stays with the
editor's spotlight when the docs are embedded.
Bring back the navbar with the five sections and search, cap the text
width, set a type scale, flatten tables, code blocks and admonitions, add
an on this page heading and prev and next links, and give standalone
visitors a colour mode switch that hides when the editor embeds the docs.
scripts/check-inbound-links.mjs reads the docs links in a sibling
scratch-gui checkout (or SCRATCH_GUI_DIR), adds the committed list of
every path the site has served, and checks each against the build,
following redirect pages. npm run check runs it and CI runs it after the
build, on Node 22.
The architecture page says scratch-gui builds with Vite, the deploy page
describes how the Cloudflare build fetches the docs tarball, the
introduction links to the current page names, and search results are
resolved against the site root so their section labels show.
AGENTS.md is in the global gitignore on this machine, so it is added with
-f. The search launcher also drops its shortcut hint on touch screens.
Muted text mixes 94% of the editor's text colour when embedded and 74%
standalone, and links and active items use the accent with its lightness
capped (light) or floored (dark), so any editor accent stays readable.
Tab cycles through the search window's controls, a status region
announces the result count, and aria-controls is only set while results
are shown. When a query has few exact matches, shorter prefixes are tried
and shown under an honest close matches label. /search/?q= opens the
search prefilled, and the shortcut hint is hidden on touch screens.
Drop Pagefind's unused UI bundles, scope the webpack expression setting
to the loader module, and make the inbound link check verify anchors,
following redirects.
The stage page now explains turbo mode and the three ways to toggle it,
the menu bar and URL parameter pages link to it, the API reference title
is in sentence case, and Applying code no longer repeats Rename a Stage
variable.
@Mistium
Mistium changed the base branch from backend-docs to master November 1, 2026 07:16
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 43af278
Status:⚡️  Build in progress...

View logs

@Mistium
Mistium merged commit b498310 into master Nov 1, 2026
2 of 3 checks passed
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