jupyter-book
jupyter-book copied to clipboard
dirhtml build index.html does not redirect to root folder
Describe the problem
When running the dirhtml build option, the root index.html doesn't change to point to the /{rootName}/index.html, instead it just points directly to /{rootName}.html.
Link to your repository or website
No response
Steps to reproduce
- Build a book with dirhtml builder.
The version of Python you're using
No response
Your operating system
No response
Versions of your packages
No response
Additional context
No response
Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:
thanks for reporting this @jackminchin I can replicate this issue locally.
Looks like the index.html is written assuming the html
<meta http-equiv="Refresh" content="0; url=intro.html" />
and it should be
<meta http-equiv="Refresh" content="0; url=intro/index.html" />
Do you get the following message in your build output
@chrisjsewell is this index.html written by https://github.com/executablebooks/sphinx-external-toc given the [etoc] message indicator?
[etoc] missing index.html written as redirect to 'intro.html'
This still seems to be an issue.
[etoc] missing index.html written as redirect to 'intro.html'
However the intro.html file is in a "intro/index.html" folder
👋🏼 everyone, I was facing this issue while working on https://jdsalaro.com and https://fhirpack.readthedocs.io so I decided to investigate a bit. In https://github.com/executablebooks/sphinx-external-toc/issues/93 I suggest a fix, but it will probably take a bit until that small fix reaches everyone getting sphinx-external-toc via PyPI.
There are three possible solutions:
-
create your book as usual, keep the
intro.mdroot and always modify your generated_build/dirhtml/index.htmlto contain<meta http-equiv="Refresh" content="0; url=intro/index.html" />or the respectiveroot_docyou have chosen<meta http-equiv="Refresh" content="0; url=root_doc/index.html" /> -
is likely the simplest, just stop using
intro.mdas a root document by modifying your_toc.ymlfile and renaming it toindex, then this issue will not arise. -
patch
events.pyinsphinx-external-tocaccording to https://github.com/executablebooks/jupyter-book/issues/1414 or wait and usesphinx-external-toconce it's released.