sphinx-doc / sphinx

The Sphinx documentation generator
https://www.sphinx-doc.org/
Other
6.56k stars 2.12k forks source link

Generate docs with absolute links #9007

Open erickskrauch opened 3 years ago

erickskrauch commented 3 years ago

Is your feature request related to a problem? Please describe. I want to generate documentation for several languages and place them on the corresponding URL prefixes (e.g. /en, /ru, /zh, etc.). But the links are generated relative, which makes it impossible to open the table of contents of a language without a leading slash:

URL: https://docs.ely.by/ru Links:

  • minecraft-auth.html => https://docs.ely.by/minecraft-auth.html
  • oauth.html => https://docs.ely.by/oauth.html

Adding a leading slash solves this problem:

URL: https://docs.ely.by/ru/ Links:

  • minecraft-auth.html => https://docs.ely.by/ru/minecraft-auth.html
  • oauth.html => https://docs.ely.by/ru/oauth.html

But I can't change the behavior of the web-server because the documentation is published on the GitHub Pages.

Describe the solution you'd like Introduce a new parameter that will generate all links absolutely. It'll be possible to set an explicit prefix for the build, i.e. /ru, /en, and so on.

tk0miya commented 3 years ago

Is it difficult to use /ru/index.html as a URL of top page? Then your problem will be resolved.

erickskrauch commented 3 years ago

It's not hard. But the user can also open the page via /ru. I want to have a solution that works always, not only under certain conditions.