Skip to content

Language switcher "中文" link 404s — alternate-language URLs missing /spatialbench/ base path #109

@jiayuasu

Description

@jiayuasu

Describe the bug
On the deployed SpatialBench docs, the header language selector's Chinese option leads to a 404. The auto-generated alternate-language links omit the /spatialbench/ base path under which the site is actually served.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://sedona.apache.org/spatialbench/
  2. Click the language selector (translate icon) in the header and choose 中文
  3. You land on https://sedona.apache.org/zh/ → "Not Found" (HTTP 404)

Expected behavior
The Chinese site should open at https://sedona.apache.org/spatialbench/zh/, which exists and returns HTTP 200. The Chinese build is correctly generated and present in the asf-site branch (zh/index.html and all subpages render fine when visited directly).

Root cause
The mkdocs-static-i18n plugin auto-populates config.extra.alternate, which Material's stock partials/alternate.html renders in docs/overrides/partials/header.html. The generated hreflang links are rooted at the domain instead of the deployment subpath:

  • en → https://sedona.apache.org/ (should be .../spatialbench/)
  • zh → https://sedona.apache.org/zh/ (should be .../spatialbench/zh/)

The English link happens to resolve to an unrelated existing page, while /zh/ 404s. This happens because mkdocs.yml does not set site_url; without it, the plugin builds the alternate URLs as absolute-from-root. (The deployed pages also emit no <link rel="canonical">, which Material only generates when site_url is set — confirming it is unset.)

Suggested fix
Add to mkdocs.yml:

site_url: https://sedona.apache.org/spatialbench/

This corrects the alternate-language links (and also fixes canonical and sitemap URLs). The deploy workflow (packaging.yml) will rebuild and push to asf-site after merging.

Additional context
The Chinese translation content and build are already in place (added in #100); this is purely a URL-generation/config issue in the language switcher links.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions