facebook / facebook/docusaurus

Broken relative links in docs and i18n translation

Ouverte
#10,907 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
bug domain: i18n
Langage dominant
TypeScript
Étoiles
66.2k
Forks
10k
Merge moyen
1 j 3 h
PR mergées (30 j)
52

Description

### Have you read the Contributing Guidelines on issues?

- [x] I have read the [Contributing Guidelines on issues](https://github.com/facebook/docusaurus/blob/main/CONTRIBUTING.md#issues).

### Prerequisites

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

### Description

Problem with relative links in docs and i18n translation.

### Reproducible demo

https://trofim24.github.io/

### Steps to reproduce

1. Create a new Docusaurus site with `npx create-docusaurus@latest my-website classic -t` command from [instruction](https://docusaurus.io/docs#fast-track)
2. Go to created folder `cd my-website`
3. Copy only one Markdown file and images use
`mkdir -p i18n/fr/docusaurus-plugin-content-docs/current/tutorial-extras/img`
`cp -r docs/tutorial-extras/img/** i18n/fr/docusaurus-plugin-content-docs/current/tutorial-extras/img`
`cp -r docs/tutorial-extras/translate-your-site.md i18n/fr/docusaurus-plugin-content-docs/current/tutorial-extras`
command from [instruction](https://docusaurus.io/docs/i18n/tutorial#translate-markdown-files)
4. Change docusaurus.config.js. Add 'fr' language to locales from [instruction](https://docusaurus.io/docs/i18n/tutorial#site-configuration) and add a navbar item of type localeDropdown from [instruction](https://docusaurus.io/docs/i18n/tutorial#theme-configuration):
`locales: ['en', 'fr']`
and
`{ type: 'localeDropdown', position: 'left', },`
5. Run build use `npm run build` command from [instruction](https://docusaurus.io/docs/deployment)

Also you can visit my build site to check broken link:
[/fr/docs/tutorial-basics/congratulations](https://trofim24.github.io/fr/docs/tutorial-basics/congratulations)
[broken link](https://trofim24.github.io/fr/docs/tutorial-extras/translate-your-site.md)

### Expected behavior

The build is OK

### Actual behavior

[WARNING] Docusaurus found broken links!

Please check the pages of your site in the list below, and make sure you don't reference any path that does not exist.
Note: it's possible to ignore broken links with the 'onBrokenLinks' Docusaurus configuration, and let the build pass.

Exhaustive list of all broken links found:
- Broken link on source page path = /fr/docs/tutorial-basics/congratulations:
-> linking to ../tutorial-extras/translate-your-site.md (resolved as: /fr/docs/tutorial-extras/translate-your-site.md)

### Your environment

- Public source code: https://github.com/trofim24/my-website
- Public source code of build: https://github.com/trofim24/trofim24.github.io
- Public site URL: https://trofim24.github.io/
- Docusaurus version used: 3.7.0
- Environment name and version (e.g. Chrome 89, Node.js 16.4): Chrome 133.0.6943.54 (Official Build) (x86_64), Node.js v20.18.2
- Operating system and version (e.g. Ubuntu 20.04.2 LTS): MacOS Ventura Version 13.7.2 (22H313)

### Self-service

- [ ] I'd be willing to fix this bug myself.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.