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

changing the root entry in _toc.yml has no effect at build #50

Open
luketudge opened this issue Jul 26, 2021 · 2 comments
Open

changing the root entry in _toc.yml has no effect at build #50

luketudge opened this issue Jul 26, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@luketudge
Copy link

Describe the problem

Whereas most changes to _toc.yml (new pages, etc.) will be taken into account on a new build, changing the root entry will only take effect if the _build directory is cleared first. If not, index.html will continue to direct to the old root entry. This seems wrong or at least inconsistent.

The culprit seems to be the automatically-generated redirect file index.html that is created if the requested root file is not already named 'index'. This file persists across builds even if _toc.yml requests a different root.

Link to your repository or website

No response

Steps to reproduce

The script below runs a hopefully reproducible example showing:

  • Other changes such as adding new files work fine.
  • Changing the root entry does not.
  • Changing the root entry does work if the build cache is first cleared.
#!/bin/bash -v

#
# Create the prefab exaple book.
# Remove the example notebook (just to avoid unnecessary dependencies).
# Simplify _toc.yml.
#
rm -r mynewbook/
jupyter-book create mynewbook/
rm mynewbook/notebooks.ipynb
echo '
format: jb-book
root: intro
chapters:
- file: markdown
' > mynewbook/_toc.yml

#
# Build.
# Confirm structure of built book.
#
jupyter-book build mynewbook/
firefox mynewbook/_build/html/index.html

#
# Add a new file.
#
echo '
# foo
' > mynewbook/foo.md
echo '
format: jb-book
root: intro
chapters:
- file: markdown
- file: foo
' > mynewbook/_toc.yml

#
# Confirm new file is added.
#
jupyter-book build mynewbook/
firefox mynewbook/_build/html/index.html

#
# Change root file.
#
echo '
format: jb-book
root: foo
chapters:
- file: markdown
' > mynewbook/_toc.yml

#
# Confirm that changed root file does NOT register.
# Old index is used.
#
jupyter-book build mynewbook/
firefox mynewbook/_build/html/index.html

#
# Finally, confirm that changed root file registers if _build cache is cleared.
#
jupyter-book clean mynewbook/
jupyter-book build mynewbook/
firefox mynewbook/_build/html/index.html

The version of Python you're using

3.8.10

Your operating system

Ubuntu 20.04.2

Versions of your packages

Jupyter Book      : 0.11.2
External ToC      : 0.2.2
MyST-Parser       : 0.13.7
MyST-NB           : 0.12.3
Sphinx Book Theme : 0.1.1
Jupyter-Cache     : 0.4.2
NbClient          : 0.5.3

Additional context

No response

@luketudge luketudge added the bug Something isn't working label Jul 26, 2021
@welcome
Copy link

welcome bot commented Jul 26, 2021

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

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! 🎉

@luketudge
Copy link
Author

I spoke too soon, sorry. I see there is already a TODO for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant