Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of .html in documentation URLs #158

Closed
5 tasks done
redeboer opened this issue Aug 5, 2023 · 4 comments · Fixed by ComPWA/qrules#245, ComPWA/ampform#388 or ComPWA/tensorwaves#515
Closed
5 tasks done
Assignees
Labels
📝 Docs Improvements or additions to documentation ❔ Question Discuss this matter in the team

Comments

@redeboer
Copy link
Member

redeboer commented Aug 5, 2023

Currently, ComPWA repos follow the following convention for files under the Sphinx source tree:

...
docs/dynamics.ipynb          --> .../dynamics.html
docs/dynamics/custom.ipynb   --> .../dynamics/custom.html
docs/dynamics/k-matrix.ipynb --> .../dynamics/k-matrix.html
...

See URL structure for this example here. It would

Note

Updates since #158 (comment): .html can be removed from the URL with Sphinx's dirhtml builder. Read the Docs supports good redirects from page.html to page/, so we can remove the .html there. GitHub Pages already supports leaving out the .html, so we can keep the html builder there.

Read the Docs repositories

  1. 📝 Docs
    redeboer
  2. 📝 Docs
    redeboer
  3. 📝 Docs
    redeboer
  4. 📝 Docs
    redeboer
  5. 📝 Docs
    redeboer
Old solution

To get rid of the .html, you would need a structure like this:

docs/dynamics/index.ipynb          --> .../dynamics
docs/dynamics/custom/index.ipynb   --> .../dynamics/custom
docs/dynamics/k-matrix/index.ipynb --> .../dynamics/k-matrix

Disadvantages:

  • Have to create folders for each notebook or Markdown source file
  • All notebooks are named index.ipynb
    Advantages:
  • Nicer URLs, e.g. compwa-org.rtfd.io/report/001
  • Dependencies and file output is contained of notebooks is contained within subfolder

Perhaps there are other solutions, like some plugin that does the hierarchy conversion to index.html in a subfolder automatically?

@redeboer redeboer added ❔ Question Discuss this matter in the team 📝 Docs Improvements or additions to documentation labels Aug 5, 2023
@redeboer
Copy link
Member Author

redeboer commented Aug 5, 2023

Note: Jupyter Book seems to generate the index.html structure by default

@redeboer
Copy link
Member Author

redeboer commented Jan 12, 2024

This can now partially be achieved on RTD with redirects:
https://docs.readthedocs.io/en/stable/user-defined-redirects.html#clean-html-urls-redirects
But this still requires a / at the end, for instance compwa-org.rtfd.io/develop/ instead of compwa-org.rtfd.io/develop

@redeboer
Copy link
Member Author

Another option: sphinx-reredirects

@redeboer
Copy link
Member Author

redeboer commented Jan 20, 2024

Solution: use dirhtml builder instead of the html builder. The effect can be seen in ComPWA/compwa.github.io#242 (which was reverted by ComPWA/compwa.github.io#243, because dirhtml is not the best for GitHub pages).

Warning

There is no good way yet to redirect the old .html URLs on GitHub pages. Neither sphinx-reredirects nor sphinxext-rediraffe seem to support {source}.html -> {source}/ redirects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📝 Docs Improvements or additions to documentation ❔ Question Discuss this matter in the team
Projects
None yet
1 participant