Closed jdsalaro closed 8 months ago
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:
Closed by #94!
Describe the bug
CONTEXT
Using
jupyter-book build
,sphinx-build
orsphinx-autobuild
on a book given:root_doc
is other thanindex.md
orindex.rst
dirhtml
builder is usedLeads to the error
[etoc] missing index.html written as redirect to
f'{root_doc}.html'and the generation of an invalid redirection
root_dir/index.htmlfile containing
f''`Regardless of whether the user manually browses to
file://root_dir/
or usessphinx-autobuild
, the browser can't find theroot_doc
as it's bogus.EXPECTATION
sphinx-build -b html . _build/html
, the builtroot_doc
will beroot_dir/root_doc.html
and thus the redirection fileindex.html
should be, as is the case nowadays, as follows:sphinx-build -b dirhtml . _build/dirhtml
, the builtroot_doc
will beroot_dir/root_doc/index.html
and thus the redirection fileindex.html
should be as follows:BUG
For the second case, what happens instead is the following:
Which is due to sphinx-external-toc/events.py#318
PROBLEM
I use
sphinx-external-toc
together withsphinx
andsphinx-autobuild
to manage my website at https://jdsalaro.com, but I'm certainly not the only one as pointed out in https://github.com/executablebooks/jupyter-book/issues/1414 and https://github.com/alan-turing-institute/the-turing-way/issues/2887FIX
The fix is rather simple as shown by the following commit in my fork: https://github.com/jdsalaro/sphinx-external-toc/commit/03e976bf422e880ff968a2c3fc5b828bec9a0f4e . The complexity of this issue revolved mostly around debugging it and finding the source of the redirection
index.html
file:The above properly handles the two possible cases according to which builder was used:
html
ordirhtml
cc @chrisjsewell @mmcky
Reproduce the bug
List your environment