Skip to content

docs(sphinx): sidebar language switcher, default to English - #519

Merged
TATP-233 merged 1 commit into
mainfrom
docs/sphinx-migration
May 28, 2026
Merged

TATP-233 merged 1 commit into
mainfrom
docs/sphinx-migration

Conversation

@caozx1110

Copy link
Copy Markdown
Collaborator

Summary

  • Move language switcher from page body to left sidebar (below title, above search)
  • Root auto-redirects to /en/index.html — no language picker landing page
  • Sidebar navigation only shows English docs; zh_CN pages accessible via switcher only
  • Fix dark-mode hero background: old CSS selector did not match Furo mechanism, causing light gradient bleed in dark mode
  • Hero h1 gradient text gets lighter palette in dark mode for proper contrast

Test plan

  • sphinx-build exit 0
  • Root redirects to /en/index.html
  • Sidebar shows language dropdown below brand, above search
  • Sidebar nav only contains English pages
  • Dark mode: hero background uses dark gradient
  • Visual review in browser (light + dark + auto themes)

🤖 Generated with Claude Code

@caozx1110
caozx1110 requested a review from TATP-233 as a code owner May 28, 2026 09:05
Copilot AI review requested due to automatic review settings May 28, 2026 09:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Sphinx/Furo documentation UX by redirecting the root docs page to English, moving the language switcher into the left sidebar, and adjusting custom CSS to properly support dark mode hero styling.

Changes:

  • Replace the root landing language-picker page with an immediate redirect to /en/index.html.
  • Add a custom Furo sidebar layout that inserts a new sidebar language switcher template.
  • Update custom CSS to fix dark-mode hero gradients and style the new sidebar language dropdown.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.

File Description
docs/sphinx/source/index.md Replaces the root landing content with an English redirect and updates the root toctree.
docs/sphinx/source/conf.py Configures Furo sidebars to include a new sidebar language switcher component.
docs/sphinx/source/_templates/sidebar/lang_switcher.html Adds a sidebar language switcher template and client-side navigation logic.
docs/sphinx/source/_static/css/custom.css Switches dark-mode hero styling to CSS-variable overrides and adds sidebar switcher styling + hides old switchers.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}());
</script>
<meta http-equiv="refresh" content="0; url=en/index.html" />
<script>window.location.href = "en/index.html";</script>
Comment on lines 14 to 19
```{toctree}
:hidden:
:caption: Languages

en/index
zh_CN/index
```

```{toctree}
:hidden:
:caption: Shared

adr/README
if (!sel) return;
sel.addEventListener("change", function(){
var url = this.value;
if (url) window.location.href = new URL(url, window.location.href).href;
Comment on lines +4 to +6
{%- set zh_target = language_switcher_targets.get("zh_CN", "zh_CN/index") if language_switcher_targets is defined else "zh_CN/index" -%}
<div class="sidebar-lang-switcher">
<select class="sidebar-lang-switcher__select" aria-label="Language">
Comment on lines +201 to +210
html_sidebars = {
"**": [
"sidebar/brand.html",
"sidebar/lang_switcher.html",
"sidebar/search.html",
"sidebar/scroll-start.html",
"sidebar/navigation.html",
"sidebar/scroll-end.html",
],
}
:root {
--ul-hero-bg: linear-gradient(135deg, #eff6ff 0%, #ede9fe 50%, #fef3c7 100%);
--ul-hero-border: rgba(99, 102, 241, 0.18);
--ul-hero-text-shadow: none;
UI changes:
- Root index.md now auto-redirects to /en/index.html (no language
  picker landing page)
- Language dropdown moved from page body to left sidebar, below the
  site title and above the search box
- Sidebar navigation only shows English docs; zh_CN pages are still
  built but accessed exclusively via the language switcher
- Add _templates/sidebar/lang_switcher.html for Furo sidebar injection
- Configure html_sidebars in conf.py to include the new component

Dark theme fix:
- Landing hero background was showing light gradient in dark mode
  because the old selector (body.dark) doesn't match Furo's actual
  dark-mode mechanism (body[data-theme="dark"] + prefers-color-scheme
  media query for auto mode)
- Now uses CSS custom properties that update in both explicit-dark and
  auto-dark scenarios
- Hero h1 gradient text also gets a lighter palette in dark mode for
  proper contrast against the dark background

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@caozx1110
caozx1110 force-pushed the docs/sphinx-migration branch from 8789bc3 to 2556119 Compare May 28, 2026 09:11
@TATP-233
TATP-233 merged commit ae269be into main May 28, 2026
7 checks passed
@TATP-233
TATP-233 deleted the docs/sphinx-migration branch May 28, 2026 14:02
TATP-233 added a commit that referenced this pull request May 30, 2026
docs(sphinx): sidebar language switcher, default to English
TATP-233 added a commit that referenced this pull request May 30, 2026
docs(sphinx): sidebar language switcher, default to English
TATP-233 added a commit that referenced this pull request Sep 4, 2026
docs(sphinx): sidebar language switcher, default to English
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.

3 participants