Skip to content

Commit 8b3285c

Browse files
authored
Docs: rebuild on Astro Starlight + cut over GitHub Pages deploy (#400)
Docs: rebuild on Astro Starlight (Terminal theme) + live-site rebrand
2 parents e41374b + 4d53672 commit 8b3285c

95 files changed

Lines changed: 16152 additions & 279 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deploy.yaml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,12 @@ on:
44
push:
55
branches:
66
- master
7-
# Review gh actions docs if you want to further define triggers, paths, etc
8-
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
7+
# Daily rebuild + manual trigger — refreshes build-time data like the GitHub
8+
# star count in site/src/data/github.ts without a manual deploy.
9+
schedule:
10+
- cron: '0 6 * * *'
11+
# Allow manual runs from the Actions tab.
12+
workflow_dispatch:
913

1014
jobs:
1115
deploy:
@@ -17,14 +21,17 @@ jobs:
1721
with:
1822
node-version: 24
1923
cache: npm
20-
cache-dependency-path: website/package-lock.json
24+
cache-dependency-path: site/package-lock.json
2125

2226
- name: Install dependencies
2327
run: npm ci
24-
working-directory: website
28+
working-directory: site
2529
- name: Build website
2630
run: npm run build
27-
working-directory: website
31+
working-directory: site
32+
env:
33+
# Lifts the GitHub API rate limit for build-time stats fetches.
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2835

2936
# Popular action to deploy to GitHub Pages:
3037
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
@@ -33,7 +40,7 @@ jobs:
3340
with:
3441
github_token: ${{ secrets.GITHUB_TOKEN }}
3542
# Build output to publish to the `gh-pages` branch:
36-
publish_dir: ./website/build
43+
publish_dir: ./site/dist
3744
# The following lines assign commit authorship to the official
3845
# GH-Actions bot for deploys to `gh-pages` branch:
3946
# https://github.com/actions/checkout/issues/13#issuecomment-724415212

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@ vendor
44
.idea
55
.hugo_build.lock
66

7+
.superpowers/
8+
.serena/
9+
.playwright-mcp/
Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# Echo Docs — rebuild on Astro Starlight ("Terminal" theme)
2+
3+
**Date:** 2026-06-14 (rev. 2 — post-review)
4+
**Status:** Design — hardened after architecture + docs-platform review
5+
**Repo:** `labstack/echox` (docs site in `website/`), branch `docs-astro-rebuild`
6+
7+
## 1. Goal
8+
9+
Replace the current Docusaurus docs with a professional, `docs.openclaw.ai`-grade site
10+
branded for Echo. The previous attempts read as "default/amateur" because of generic
11+
system-sans on a cool palette; the new design commits to a **terminal-precise** aesthetic.
12+
13+
## 2. Locked decisions (rev. 2)
14+
15+
| Decision | Choice | Notes |
16+
|---|---|---|
17+
| Platform | **Astro Starlight** (base) + custom Terminal theme | *Changed from full-custom Astro after review.* Starlight gives sidebar, i18n+fallback, Pagefind search, prev/next, TOC, edit links, last-updated, per-page SEO/OG, sitemap, 404, theme toggle, mobile drawer, a11y baseline — we override the theme for the look. Far less to build/own. |
18+
| Design direction | **Terminal** | Locked via mockups (`refine-terminal.html`, `home.html`). |
19+
| Fonts | **DM Sans** for prose & headings · **Fragment Mono** for code + UI chrome (nav, sidebar, labels, ⌘K) | *Changed from mono-everywhere* for long-form readability; terminal feel kept in chrome/code. |
20+
| Palette | warm near-black `#0d0b0b`, warm grays, **Echo cyan** | Cyan from logo; **contrast-tuned** (see §6). |
21+
| Theme | dark-first + light | Starlight toggle; dark default. |
22+
| Content | rewritten fresh, **seeded by porting existing pages** | Avoid blank-page risk on 61 existing pages (review). |
23+
| Launch versioning | **v5 only**; v4 added later via `starlight-versions` | Defers Starlight's one weak area. |
24+
| Search + Ask Echo | **unified ⌘K** with Search (Pagefind) + Ask tabs | Override Starlight `Search` component. |
25+
| Deploy | **Cloudflare Pages** (+ `_redirects`) | Fast, Pagefind-friendly, native 301s. |
26+
27+
## 3. What Starlight gives us vs. what we build
28+
29+
- **Starlight (free):** content collections, sidebar config, prev/next, TOC, Pagefind ⌘K,
30+
i18n routing + en-fallback, per-page `<title>`/description/canonical/OG/Twitter, sitemap,
31+
`404`, edit-on-GitHub (`editLink`), `lastUpdated` from git, dark/light toggle + persistence,
32+
mobile drawer, keyboard-accessible nav.
33+
- **We build/own:**
34+
1. **Terminal theme**`src/styles/terminal.css` (Starlight CSS custom props + targeted
35+
overrides), Shiki theme JSON, font wiring (DM Sans prose / Fragment Mono chrome+code).
36+
2. **Unified ⌘K** — override `components.Search` with `CommandPalette.tsx` (Pagefind tab + Ask tab).
37+
3. **Ask Echo** — provider-pluggable island; stub stream now, `askProvider(query, locale)` hook
38+
for kapa.ai / Inkeep + key later.
39+
4. **DocActions** — Copy page / Open in ChatGPT / Open in Claude (Edit + Last-updated already from Starlight).
40+
5. **Homepage** — custom `index.astro` (Starlight `splash` template or standalone): split hero
41+
+ code window + stats + feature grid.
42+
6. **Redirect map, analytics, contrast/a11y tuning, cutover** (§6, §7).
43+
44+
## 4. Architecture
45+
46+
```
47+
website/
48+
astro.config.mjs # starlight() integration: title, logo, social, editLink,
49+
# lastUpdated, sidebar, locales, components overrides, sitemap
50+
src/
51+
content/docs/ # MDX content (Starlight collection)
52+
index.mdx # homepage (splash) OR pages/index.astro
53+
<locale>/core/routing.mdx ... # en authored first
54+
components/ # Starlight component overrides
55+
Search.astro # mounts CommandPalette island (unified ⌘K)
56+
CommandPalette.tsx # island: Search (Pagefind JS API) + Ask Echo tabs
57+
DocActions.astro # copy / ChatGPT / Claude toolbar (in PageFrame or content)
58+
styles/
59+
terminal.css # the design system (tokens + overrides)
60+
shiki/echo-terminal.json # custom Shiki theme (warm bg, cyan keywords)
61+
public/
62+
logo-*.svg og-*.png robots.txt _redirects # Cloudflare 301 map
63+
```
64+
65+
**Isolation:** the theme is pure CSS over Starlight's documented custom properties → no fork
66+
of Starlight internals; only two component overrides (`Search`, optionally `Head`/`PageFrame`
67+
for DocActions). `CommandPalette.tsx` and `AskEcho` logic are self-contained islands. Content
68+
is the single source of truth; everything else is configuration + theme.
69+
70+
## 5. Design system (`terminal.css`)
71+
72+
- **Fonts:** `--sl-font: "DM Sans", ui-sans-serif, system-ui, sans-serif` (prose+headings);
73+
`--sl-font-mono: "Fragment Mono", ui-monospace, SFMono-Regular, Menlo, monospace` (code).
74+
Apply Fragment Mono to UI chrome (`.sidebar`, site nav, `.sl-markdown-content` inline UI,
75+
labels, ⌘K) via targeted selectors. **Self-host both fonts** (woff2, subset), `font-display:swap`,
76+
`preload` the prose font (FOUT fix).
77+
- **Color (dark):** bg `#0d0b0b`, surface `#151210`, line `#221e1c`/`#2d2724`, text `#aaa19d`,
78+
heading `#f4f1ef`, muted `#817a76`. Map to Starlight `--sl-color-*`.
79+
- **Accent (contrast-tuned):** use brighter cyan **`#33c9e6`** for small text/links on dark
80+
(≥ ~7:1) and reserve `#00afd1``#4ae1ff` for fills/large/decorative — fixes the ~5.9:1 issue.
81+
- Light theme: warm paper `#faf8f7`, ink `#1a1614`, darker cyan for AA.
82+
- Radius 9–13px; hairline borders; one soft cyan glow; faint grain (disabled under
83+
`prefers-reduced-motion`).
84+
85+
## 6. Production / launch requirements (added per review)
86+
87+
- **SEO:** rely on Starlight per-page title/description/canonical/OG; ensure every MDX has
88+
`title` + `description` frontmatter. Add **JSON-LD** (`TechArticle` + `BreadcrumbList`) and
89+
`public/robots.txt` → sitemap. Set **v5 as `rel=canonical`** version.
90+
- **Redirects (deliverable):** crawl the live site, produce an explicit **old→new 301 table**
91+
in `public/_redirects`. Cover the 3 alias families (`/guide`, `/cookbook`, `/middleware`),
92+
the one-off redirects, and any old slug with no 1:1 new home (resolve each). No silent drops.
93+
- **Analytics:** carry over **GA4 `G-H19TMZLQFN`** (anonymizeIP) via Starlight `head` inject;
94+
confirm whether to keep or replace.
95+
- **Broken-link gate:** CI step (`lychee`/`astro-broken-link-checker`) that **fails the build**,
96+
matching the old `onBrokenLinks: throw`.
97+
- **Accessibility:** WCAG-AA contrast audit of every token pair; `:focus-visible` rings;
98+
`prefers-reduced-motion` disables glow/grain; the ⌘K palette uses an accessible
99+
combobox pattern (focus trap, `aria-activedescendant`, SR announcements).
100+
- **Responsive:** Starlight handles sidebar/TOC drawers; we ensure the **homepage hero stacks**
101+
(terminal window below headline) on mobile.
102+
- **i18n realism:** keep non-en locales **behind a flag** until real translations exist; add
103+
`hreflang` + `x-default` when they ship; Ask Echo answers carry a `locale` param with an
104+
"answers in English" note where the provider lacks localization.
105+
- **CodeBlock features:** copy button, language label, filename, line-highlighting, and
106+
tabbed examples (Starlight Expressive-Code or our wrapper).
107+
108+
## 7. Implementation phasing
109+
110+
- **Phase 1 — Platform + theme + slice (first plan).** Starlight scaffold in `website/`
111+
(replacing Docusaurus), `terminal.css` design system + Shiki theme + self-hosted fonts,
112+
`Search``CommandPalette` override with Ask Echo island (stubbed), `DocActions`, custom
113+
**homepage**, contrast/a11y tokens, and a real **content slice** (Quickstart, Routing w/ code,
114+
one nested page). Final `/...` URL/Pagefind/i18n config in place. Dark+light. Shippable to a
115+
**preview** subdomain.
116+
- **Phase 2 — Content.** Author full v5/en docs (Guide, Core, Cookbook, Middleware, API),
117+
seeded by porting+editing existing pages. Site is launch-ready at completion.
118+
- **Phase 3 — Versioning + locales + cutover.** `starlight-versions` for v4, enable locales +
119+
translations, finalize `_redirects`, GA, JSON-LD, broken-link CI, **cutover runbook**
120+
(preview → verify redirects/SEO/search → domain swap on `echo.labstack.com` → keep old
121+
Docusaurus deployable ~2 weeks for rollback).
122+
123+
## 8. Out of scope (now)
124+
125+
Live AI provider keys (UI + hook only); real translations (scaffold only); marketing pages
126+
beyond the homepage; v4 content (Phase 3).
127+
128+
## 9. Risks
129+
130+
- **Content rewrite is the largest cost** (61 pages × locales) — Phase 2 may need its own
131+
decomposition; mitigate by porting existing prose rather than blank-page rewriting.
132+
- **Starlight theming ceiling:** the Terminal look must be achievable via custom props +
133+
light component overrides; if a surface resists theming, prefer a small component override
134+
over forking Starlight. (Low risk — the look was already achieved via CSS on Docusaurus.)
135+
- **`starlight-versions` maturity** for v4 in Phase 3 — re-evaluate at that point; v5-only
136+
launch de-risks it.

site/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
node_modules/
2+
dist/
3+
.astro/
4+
.DS_Store

site/astro.config.mjs

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
import { defineConfig } from 'astro/config';
2+
import starlight from '@astrojs/starlight';
3+
import { redirects } from './src/redirects.mjs';
4+
5+
// https://astro.build/config
6+
export default defineConfig({
7+
site: 'https://echo.labstack.com',
8+
// Preserve every live Docusaurus /docs/* URL at cutover (generated — see ./src/redirects.mjs).
9+
redirects,
10+
integrations: [
11+
starlight({
12+
title: 'Echo',
13+
logo: {
14+
light: './src/assets/logo-light.svg',
15+
dark: './src/assets/logo-dark.svg',
16+
replacesTitle: true,
17+
},
18+
customCss: ['./src/styles/terminal.css'],
19+
social: [
20+
{ icon: 'github', label: 'GitHub', href: 'https://github.com/labstack/echo' },
21+
],
22+
editLink: {
23+
baseUrl: 'https://github.com/labstack/echox/edit/master/site/',
24+
},
25+
lastUpdated: true,
26+
// Echo "E" cube mark; .ico kept as legacy fallback, apple-touch-icon added in head.
27+
favicon: '/favicon.svg',
28+
// Keep Starlight's built-in Pagefind ⌘K search; add Ask Echo + DocActions via overrides.
29+
components: {
30+
Footer: './src/components/Footer.astro',
31+
PageTitle: './src/components/PageTitle.astro',
32+
},
33+
head: [
34+
// Google Analytics (carried over from the Docusaurus site, anonymized IP).
35+
{ tag: 'script', attrs: { async: true, src: 'https://www.googletagmanager.com/gtag/js?id=G-H19TMZLQFN' } },
36+
{
37+
tag: 'script',
38+
content:
39+
"window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}gtag('js',new Date());gtag('config','G-H19TMZLQFN',{anonymize_ip:true});",
40+
},
41+
// Dark-first: default new visitors to dark unless they've chosen otherwise.
42+
{
43+
tag: 'script',
44+
content: "try{if(!localStorage.getItem('starlight-theme')){localStorage.setItem('starlight-theme','dark');document.documentElement.dataset.theme='dark';}}catch(e){document.documentElement.dataset.theme='dark';}",
45+
},
46+
{ tag: 'link', attrs: { rel: 'preconnect', href: 'https://fonts.googleapis.com' } },
47+
{ tag: 'link', attrs: { rel: 'preconnect', href: 'https://fonts.gstatic.com', crossorigin: true } },
48+
{
49+
tag: 'link',
50+
attrs: {
51+
rel: 'stylesheet',
52+
href: 'https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&family=Fragment+Mono&display=swap',
53+
},
54+
},
55+
{
56+
tag: 'link',
57+
attrs: {
58+
rel: 'stylesheet',
59+
href: 'https://unpkg.com/@phosphor-icons/web@2.1.1/src/regular/style.css',
60+
},
61+
},
62+
// Default social card. Starlight already emits og:title/description/url
63+
// and twitter:card=summary_large_image, but no image — add a site-wide
64+
// default so shares aren't imageless. Absolute URLs are required by
65+
// social scrapers. Per-page overrides can set their own og:image later.
66+
{ tag: 'meta', attrs: { property: 'og:image', content: 'https://echo.labstack.com/og.png' } },
67+
{ tag: 'meta', attrs: { property: 'og:image:width', content: '1200' } },
68+
{ tag: 'meta', attrs: { property: 'og:image:height', content: '630' } },
69+
{ tag: 'meta', attrs: { name: 'twitter:image', content: 'https://echo.labstack.com/og.png' } },
70+
{ tag: 'link', attrs: { rel: 'apple-touch-icon', href: '/apple-touch-icon.png' } },
71+
],
72+
// Autogenerated from the content dirs — new pages appear automatically,
73+
// ordered by each page's `sidebar.order` frontmatter.
74+
sidebar: [
75+
{ label: 'Guide', items: [{ autogenerate: { directory: 'guide' } }] },
76+
{ label: 'Middleware', items: [{ autogenerate: { directory: 'middleware' } }] },
77+
{ label: 'Cookbook', items: [{ autogenerate: { directory: 'cookbook' } }] },
78+
],
79+
// tune the built-in code theme toward our terminal palette
80+
expressiveCode: { themes: ['github-dark', 'github-light'] },
81+
}),
82+
],
83+
});

0 commit comments

Comments
 (0)