Skip to content

auto-translated hash-links fail to route correctly #11386

@Alex-Genovese

Description

@Alex-Genovese

Have you read the Contributing Guidelines on issues?

Prerequisites

  • I'm using the latest version of Docusaurus.
  • I have tried the npm run clear or yarn clear command.
  • I have tried rm -rf node_modules yarn.lock package-lock.json and re-installing packages.
  • I have tried creating a repro with https://new.docusaurus.io.
  • I have read the console error message carefully (if applicable).

Description

When auto-translating a Docusaurus generated page, the left hand side bar links work correctly but the right hand Table of Contents fail to route and translation ceases. This also applies to hash-link anchors at the ends of contents titles and to hash-links in the text body. The link route may also route back to a completely different but previously viewed page.

See attached file. The first tab shows a page working correctly in English then moves on to several tabs each with different failure examples.

dcs-blog-qqx-combo.mp4

Reproducible demo

No response

Steps to reproduce

Go to this page in any browser

This page has the latest build code and reflects the fixes made with #11360 for issue #11358

Expected behavior

The links should route correctly and the translation should be maintained.

Other documenting systems are able to demonstrate correct behaviour with hash-links eg. Qemu

There is an npm module called react-router-hash-link which shows how this should work. This may also hold a possible solution?

See demo of this module at work:

react-router-hash-link-demo.1080p.x264.mp4

Actual behavior

The actual behaviour is fully documented in the initial video.

This shows, for example, the auto-translated Docusaurus blog for release 3.7, in French, routing to the 3.8 blog in English, when the ToC link for 'Souligner' is clicked.

Your environment

The reproducible example links all have the latest Docusaurus builds and the behaviour is the same in all browsers and across different Operating systems.

Self-service

  • I'd be willing to fix this bug myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn error in the Docusaurus core causing instability or issues with its execution

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions