openclaw - 💡(How to fix) Fix Docs language switcher loses page path (Mintlify platform behavior) [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#73446Fetched 2026-04-29 06:19:49
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
0
Timeline (top)
commented ×1mentioned ×1subscribed ×1

Root Cause

We attempted two PRs (#73415, #73436) adding a docs/locale-path-preserve.js script that would intercept the dropdown click and navigate to the preserved path. Both were closed by @steipete because:

Code Example

// Puppeteer result from live docs.openclaw.ai
{
  id: "localization-select-item-zh-Hans",
  tag: "DIV",           // not "A"
  href: null,           // no href at all
  text: "简体中文",
  selected: "false"
}

---

curl -sI "https://docs.openclaw.ai/nav-tabs-underline.js"404
curl -sI "https://docs.openclaw.ai/style.css"404

---

cd /tmp && npm install puppeteer-core

---

import puppeteer from 'puppeteer-core';

const browser = await puppeteer.launch({
  headless: 'new',
  executablePath: '<your-chrome-binary>',
  args: ['--no-sandbox']
});
const page = await browser.newPage();
await page.setViewport({ width: 1280, height: 900 });
await page.goto('https://docs.openclaw.ai/start/getting-started', { waitUntil: 'networkidle2' });

// Click language trigger
const { x, y } = await page.evaluate(() => {
  const r = document.querySelector('#localization-select-trigger').getBoundingClientRect();
  return { x: r.x + r.width / 2, y: r.y + r.height / 2 };
});
await page.mouse.click(x, y);
await new Promise(r => setTimeout(r, 2000));

// Inspect dropdown items
const items = await page.evaluate(() =>
  Array.from(document.querySelectorAll('[role=menuitem]')).map(el => ({
    id: el.id, tag: el.tagName, href: el.getAttribute('href'),
    text: el.textContent.trim(), selected: el.dataset.selected
  }))
);
console.log(JSON.stringify(items, null, 2));
await browser.close();

---

document.querySelectorAll('[role=menuitem]').forEach(el =>
  console.log(el.id, el.tagName, el.getAttribute('href'))
);
RAW_BUFFERClick to expand / collapse

Related

  • Previous issue: #34021 (closed by stale bot, same problem)
  • Attempted fix PRs: #73415, #73436 (closed — see explanation below)

Problem

When switching languages via the Mintlify language dropdown (top-left), the site navigates to the target locale's homepage instead of the equivalent page.

Reproduction:

  1. Open https://docs.openclaw.ai/install/docker
  2. Click the language dropdown → select 简体中文
  3. Expected: navigates to /zh-CN/install/docker
  4. Actual: navigates to /zh-CN (Chinese homepage)

Same behavior in reverse — switching from any Chinese page back to English also loses the path.

Technical analysis

This is a Mintlify platform behavior, not a bug in OpenClaw's docs content or config. We inspected the live DOM via Puppeteer and found:

The dropdown items are <div>, not <a>

// Puppeteer result from live docs.openclaw.ai
{
  id: "localization-select-item-zh-Hans",
  tag: "DIV",           // not "A"
  href: null,           // no href at all
  text: "简体中文",
  selected: "false"
}

All 14 language items are <div role="menuitem"> elements rendered lazily by Radix UI when the dropdown opens. There are no <a href="..."> links — navigation is handled entirely by Mintlify's internal JavaScript. This means there's no client-side hook to intercept and rewrite the target URL.

CSS selectors confirmed

Mintlify's localization dropdown uses these IDs (matching their custom-scripts docs):

SelectorRole
#localization-select-triggerButton that opens the dropdown
#localization-select-contentDropdown container (Radix portal, rendered on open)
[data-component-part="localization-select-item"]Each language option (<div>)

The item id encodes the Mintlify locale code: localization-select-item-{locale} (e.g. zh-Hans, ja, es).

Locale code → URL prefix mapping

The Mintlify language code doesn't always match the URL prefix used in docs.json navigation:

Mintlify codeURL prefixLanguage
en(none)English
zh-Hanszh-CN简体中文
jaja-JP日本語
esesEspañol
pt-BRpt-BRPortuguês (BR)
koko한국어
dedeDeutsch
frfrFrançais
ararالعربية
ititItaliano
trtrTürkçe
ukukУкраїнська
ididBahasa Indonesia
plplPolski

Existing custom JS files are not served

The repo already has docs/nav-tabs-underline.js and docs/style.css, but both return 404 on the live site:

curl -sI "https://docs.openclaw.ai/nav-tabs-underline.js"   → 404
curl -sI "https://docs.openclaw.ai/style.css"               → 404

This means Mintlify does not automatically serve .js files from the docs root, contradicting their documentation that says "Mintlify includes any .js file inside your content directory on every page".

Why we couldn't fix it

We attempted two PRs (#73415, #73436) adding a docs/locale-path-preserve.js script that would intercept the dropdown click and navigate to the preserved path. Both were closed by @steipete because:

  1. docs/docs.json has no custom-script configuration field
  2. The existing custom JS files in the repo are not actually served by Mintlify
  3. Locale config is generated by scripts/docs-sync-publish.mjs from GENERATED_LOCALES — a hardcoded list would drift from that source of truth
  4. We couldn't verify the fix locally — npx mintlify dev hangs on this repo (possibly needs auth or the large docs.json causes issues)

We agree the approach of adding a standalone JS file is too fragile without understanding how Mintlify's custom-script integration actually works in this repo's publish pipeline.

Possible approaches

  1. Mintlify-side fix: Report to Mintlify that their language switcher should preserve the current page path when switching locales. This is ultimately their responsibility.
  2. Publish pipeline: If Mintlify supports custom scripts through a config mechanism, wire it through docs/docs.json and the sync pipeline so it's properly deployed.
  3. Mintlify local dev: If there's a way to run mintlify dev against this repo (auth token? smaller config?), that would unblock local verification and future contributions.

Reproduction script (Puppeteer)

For anyone who wants to verify the DOM findings independently:

cd /tmp && npm install puppeteer-core
import puppeteer from 'puppeteer-core';

const browser = await puppeteer.launch({
  headless: 'new',
  executablePath: '<your-chrome-binary>',
  args: ['--no-sandbox']
});
const page = await browser.newPage();
await page.setViewport({ width: 1280, height: 900 });
await page.goto('https://docs.openclaw.ai/start/getting-started', { waitUntil: 'networkidle2' });

// Click language trigger
const { x, y } = await page.evaluate(() => {
  const r = document.querySelector('#localization-select-trigger').getBoundingClientRect();
  return { x: r.x + r.width / 2, y: r.y + r.height / 2 };
});
await page.mouse.click(x, y);
await new Promise(r => setTimeout(r, 2000));

// Inspect dropdown items
const items = await page.evaluate(() =>
  Array.from(document.querySelectorAll('[role=menuitem]')).map(el => ({
    id: el.id, tag: el.tagName, href: el.getAttribute('href'),
    text: el.textContent.trim(), selected: el.dataset.selected
  }))
);
console.log(JSON.stringify(items, null, 2));
await browser.close();

Or in-browser: F12 → Console → expand language dropdown → run:

document.querySelectorAll('[role=menuitem]').forEach(el =>
  console.log(el.id, el.tagName, el.getAttribute('href'))
);

extent analysis

TL;DR

The most likely fix involves reporting the issue to Mintlify to preserve the current page path when switching locales or exploring custom script integration through the publish pipeline.

Guidance

  1. Verify Mintlify's documentation: Confirm if there's an updated or correct way to integrate custom scripts that can intercept and modify the language switcher's behavior.
  2. Explore Mintlify's custom-script configuration: Investigate if docs/docs.json or another configuration file can be used to specify custom scripts that run on page load or on specific events like language switching.
  3. Contact Mintlify support: Reach out to Mintlify to report the issue and inquire about the best approach to preserve the page path during language switching, considering their platform's behavior and limitations.
  4. Local development setup: Attempt to set up a local development environment with mintlify dev to test and verify any potential fixes or custom scripts, addressing any issues like authentication or configuration that might be causing it to hang.

Example

No specific code example can be provided without further details on Mintlify's custom script integration or the exact requirements for preserving the page path. However, the approach would likely involve adding a custom JavaScript file that listens for the language switch event and manually updates the URL to include the current page path.

Notes

  • The solution depends heavily on Mintlify's platform capabilities and documentation, which may not be fully accurate or up-to-date.
  • Local development and testing are crucial but are currently hindered by issues with running mintlify dev on the repository.

Recommendation

Apply a workaround by reporting the issue to Mintlify and exploring their custom script integration options, as this approach addresses the root cause and leverages the platform's intended functionality.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix Docs language switcher loses page path (Mintlify platform behavior) [1 comments, 2 participants]