jupyter-book icon indicating copy to clipboard operation
jupyter-book copied to clipboard

dirhtml build index.html does not redirect to root folder

Open jackminchin opened this issue 4 years ago • 3 comments

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

  1. 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

jackminchin avatar Aug 03 '21 12:08 jackminchin

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:

welcome[bot] avatar Aug 03 '21 12:08 welcome[bot]

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'

mmcky avatar Aug 09 '21 03:08 mmcky

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

Epod avatar Sep 13 '22 03:09 Epod

👋🏼 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:

  1. create your book as usual, keep the intro.md root and always modify your generated _build/dirhtml/index.html to contain <meta http-equiv="Refresh" content="0; url=intro/index.html" /> or the respective root_doc you have chosen <meta http-equiv="Refresh" content="0; url=root_doc/index.html" />

  2. is likely the simplest, just stop using intro.md as a root document by modifying your _toc.yml file and renaming it to index, then this issue will not arise.

  3. patch events.py in sphinx-external-toc according to https://github.com/executablebooks/jupyter-book/issues/1414 or wait and use sphinx-external-toc once it's released.

jdsalaro avatar Jul 04 '23 00:07 jdsalaro