wiki: one header on every page, English by default, one switch for 中文

Each section carried its own copy of the header: Home's nav had no Home,
the docs' nav had no Docs, the research post had no star or theme button,
and the generated Alpha Library pages had no header at all. Only the docs
could switch language, and they guessed Chinese from the browser while
every other page stayed English.

- partials/ holds one head block, header and footer; sync_site_chrome.py
  writes them into every page between markers and, with --check in CI,
  also requires <body data-section> (the current section is highlighted by
  CSS), the language attributes and a single ?v= token site-wide. The
  Alpha Library generator inserts the same partials.
- site.js is the shared shell (theme, stars, language, footer traffic on
  home only). English is the HTML; Chinese comes from locales/zh.json via
  data-i18n hooks, and check_i18n.py fails on a key with no Chinese or a
  Chinese string nothing uses. A URL that names a language (/docs/zh/,
  the two articles) shows it and remembers it; everything else follows the
  stored choice, English by default. theme-init.js keeps a page hidden until
  its Chinese text is in, so it never flashes English.
- English tutorial and Chinese research post added. The Chinese tutorial
  gets the corrections its translation surfaced: 462 alphas in five zoos,
  AAPL.US, the mandate caps trades per day (it has no daily loss limit),
  Shadow Account extracts up to five rules, the web UI needs Docker or a
  checkout.
- Alpha Library: the zoo pages were never deployed — content/ is
  gitignored and nothing built it, so every zoo link served the root
  redirect. The deploy now exports the manifest and renders the pages (and
  redeploys when agent/src/factors changes); the fifth zoo, fundamental, is
  listed; generated pages allow same-origin scripts only.
- Phones keep the nav as a scrollable row instead of hiding it.
This commit is contained in:
Haozhe Wu committed 2026-09-29 17:53:13 +08:00
1 parent 36485bf55b
commit a7f645f368
32 files changed
+2766 -717

No files matched your search

+15
View File
@@ -6,6 +6,7 @@ on:
- main
paths:
- "wiki/**"
- "agent/src/factors/**"
- ".github/workflows/wiki-deploy.yml"
concurrency:
@@ -23,6 +24,20 @@ jobs:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
# The Alpha Library pages are generated, not committed: export the
# registry's manifest and render one page per alpha before uploading.
- name: Set up Python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: "3.11"
- name: Build the Alpha Library
run: |
python -m pip install --quiet -e .
vibe-trading alpha export-manifest --out wiki/alpha-library/manifest.json --force
python wiki/scripts/build_alpha_library.py --clean
test -f wiki/alpha-library/content/index.json
- name: Deploy wiki
uses: cloudflare/wrangler-action@ebbaa1584979971c8614a24965b4405ff95890e0 # v4.0.0
with:
+12 -2
View File
@@ -30,8 +30,10 @@ jobs:
- name: Check JavaScript syntax
run: |
node --check wiki/site.js
node --check wiki/main.js
node --check wiki/theme.js
node --check wiki/theme-init.js
node --check wiki/alpha-library/alpha.js
node --check wiki/docs/content.js
node --check wiki/docs/content.en.js
node --check wiki/docs/content.zh.js
@@ -41,7 +43,15 @@ jobs:
run: node wiki/scripts/check_docs_parity.mjs
- name: Check locale JSON
run: python -m json.tool wiki/locales/en.json >/dev/null
run: python -m json.tool wiki/locales/zh.json >/dev/null
- name: Check every page carries the shared header, footer and head block
run: python wiki/scripts/sync_site_chrome.py --check
- name: Check every translatable string has Chinese
run: |
python -m pip install --quiet jinja2
python wiki/scripts/check_i18n.py
- name: Check social card metadata
run: python wiki/scripts/check_social_cards.py