jiayuasu opened a new pull request, #2945:
URL: https://github.com/apache/sedona/pull/2945

   ## Did you read the Contributor Guide?
   
   - Yes, I have read the [Contributor 
Rules](https://sedona.apache.org/latest/community/rule/) and [Contributor 
Development Guide](https://sedona.apache.org/latest/community/develop/)
   
   ## Is this PR related to a ticket?
   
   - Yes, and the PR name follows the format `[GH-XXX] my subject`. Part of 
#2867.
   
   ## What changes were proposed in this PR?
   
   Follow-up to #2936. The 文A language switcher was still producing broken URLs 
when the deployed mike alias was not `latest` — for example on 
`https://sedona.apache.org/latest-snapshot/` clicking 中文 navigated to 
`https://sedona.apache.org/latest-snapshot/latest/zh/`, which 404s.
   
   Root cause: `mkdocs-static-i18n` derives `alt.link` from 
`urlsplit(config.site_url).path`. The mike plugin rewrites `config.site_url` to 
include `canonical_version` (configured as `latest` in this site), so every alt 
link ends up prefixed with `/latest/` at build time, regardless of which alias 
the build is actually being deployed under. `#2936` only stripped the leading 
slash, which is not enough — the `/latest/` segment then resolves relative to 
the current alias's path and produces `/latest-snapshot/latest/zh/…`.
   
   This PR reads `canonical_version` from the mike plugin config in 
`docs-overrides/partials/alternate.html` and strips that 
`/<canonical_version>/` prefix from `alt.link` before piping through the `| 
url` filter. The remaining path resolves against the docs root of whichever 
alias is actually being served.
   
   ## How was this patch tested?
   
   Locally with `mike deploy --branch <test> latest-snapshot` followed by a 
threaded static server, verifying the rendered `<a 
class=\"sd-lang-switch__link\">` hrefs across several pages:
   
   | Page | English link | 中文 link |
   |---|---|---|
   | `/latest-snapshot/` | `.` | `zh/` |
   | `/latest-snapshot/zh/` | `..` | `./` |
   | `/latest-snapshot/sedonaspark/` | `./` | `../zh/sedonaspark/` |
   | `/latest-snapshot/zh/sedonaspark/` | `../../sedonaspark/` | `./` |
   
   All resolve to the correct path inside the deployed alias.
   
   ## Did this PR include necessary documentation updates?
   
   - No, this PR does not affect any public API so no need to change the 
documentation.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to