Skip to content

chore: migrate docs site from VitePress to Scalar Docs - #6

Open
sheepbox8646 wants to merge 1 commit into
mainfrom
chore/migrate-to-scalar-docs
Open

chore: migrate docs site from VitePress to Scalar Docs#6
sheepbox8646 wants to merge 1 commit into
mainfrom
chore/migrate-to-scalar-docs

Conversation

@sheepbox8646

Copy link
Copy Markdown
Member

Replaces the VitePress setup with Scalar Docs. URL structure and information architecture are unchanged.

Self-written components → Scalar components

Before (hand-rolled) After (Scalar)
DocsHome.vue + 106-line theme/style.css <PageLink> cards on both home pages
::: tip / warning / danger containers <Callout type="info|warning|danger">
88 Vue window.location.replace redirect stubs siteConfig.routing.redirects
locales + en.ts / zh.ts sidebars Scalar versions + built-in version selector
themeConfig.nav navigation.tabs (also scopes the sidebar)
themeConfig.footer siteConfig.footerdocs/footer.html
Local search, dark-mode toggle, TOC Built into Scalar

docs/.vitepress/ is gone, along with the Vue dependency. Ten pages that use components were renamed to .mdx and import from scalar-mdx-components.

Bilingual routing

Scalar Docs has no first-class i18n, so both languages are wired up as versions. The CLI's getVersionPathPrefix serves default unprefixed and slugifies every other key into a path prefix — so zh reproduces the existing /zh/* URLs exactly, and Scalar renders the language switcher in the header. Route keys inside the zh version are written without the /zh prefix; Scalar adds it.

Verification

Ran the real build via @scalar/cli, plus headless screenshots:

  • check-config passes; all 108 pages preprocess with no errors
  • Sidebars generate 52 English + 52 Chinese URLs, fully mirrored
  • Internal links dropped their .md suffixes — 0 unresolved links, 0 missing images, every page on disk is routed and every route points at a real file
  • This surfaced one pre-existing dead link (/zh/integrations/providers/tts/index) that VitePress had hidden behind ignoreDeadLinks: true — fixed here
  • Screenshots confirm logo, language switcher, tab-scoped sidebar, Callout rendering, tables, and dark-mode toggle

⚠️ Two things needed before this can go live

1. Hosting moves to Scalar. Scalar Docs is a hosted platform and the CLI has no static-export command, so the GitHub Pages deploy no longer applies. The workflow is replaced by check-config on PRs and project publish on tags. To actually deploy you still need to:

  • Point the docs CNAME at dns.scalar.com (DNS-only, no proxy)
  • Create the project in the Scalar Dashboard
  • Add SCALAR_API_KEY to repository secrets

Until then the site will not be published.

2. Chrome text on Chinese pages stays English ("Search…", "On This Page", "Copy Page"). Scalar's localization only covers the API Reference UI; Docs has no per-version language setting. This is a platform limitation, not something configurable here.

🤖 Generated with Claude Code

Replace the VitePress setup with Scalar Docs, keeping the existing URL
structure and information architecture unchanged.

Self-written components are swapped for Scalar-provided ones:

- DocsHome.vue + theme/style.css -> <PageLink> cards on both home pages
- ::: tip/warning/danger containers -> <Callout type="..."> (10 pages
  renamed to .mdx and importing from scalar-mdx-components)
- 88 Vue window.location.replace redirect stubs -> siteConfig.routing.redirects
- locales + en.ts/zh.ts sidebars -> Scalar versions + built-in version selector
- themeConfig.nav -> navigation.tabs, which also scopes the sidebar
- themeConfig.footer -> siteConfig.footer (docs/footer.html)

Local search, dark-mode toggle and the TOC now come from Scalar, so
docs/.vitepress/ is removed along with the Vue dependency.

Bilingual routing uses Scalar versions: the `default` version is served
unprefixed and every other key becomes a path prefix, so `zh` reproduces
the existing /zh/* URLs and Scalar renders the language switcher. Route
keys inside the `zh` version are written without the /zh prefix.

Internal links drop their .md suffixes to match the new routes. This also
surfaced one pre-existing dead link (/zh/integrations/providers/tts/index),
which VitePress had hidden behind ignoreDeadLinks: true.

Verified with @scalar/cli: config validates, all 108 pages preprocess with
no errors, sidebars generate 52 mirrored URLs per language, and there are
no unresolved internal links, missing images, unrouted pages, or routes
pointing at missing files.

Hosting moves to Scalar, which has no static export, so the GitHub Pages
workflow is replaced by check-config on PRs and project publish on tags.
Going live still needs a CNAME for docs.memoh.ai pointing at
dns.scalar.com, a Scalar Dashboard project, and a SCALAR_API_KEY secret.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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