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

Builld does not recognize ToC changes to title attributes of files

Open joelostblom opened this issue 3 years ago • 3 comments

Describe the problem

When I add or modify the title section of a file in _toc.yml, jupyterbook does not include this update when building the pages. When I modify the title section of a url entry jupytebook correctly recognizes this change when building pages and the updated title is in the newly built book. As a workaround I make updates to the url titles when I want the file titles to update and then undo the url title changes and build the book again (it seems like the URL title changes need to be in the same section as the file changes for the change to take place).

Similar older issue here https://github.com/executablebooks/jupyter-book/issues/478

Link to your repository or website

No response

Steps to reproduce

This is what the relevant part of my toc file looks like:

format: jb-book
root: intro.md
parts:
  - caption: Worksheets
    numbered: 1
    chapters:
      - file: worksheets/worksheet1/worksheet1.md
        sections:
          - file: worksheets/worksheet1/py/student/worksheet1_py.ipynb
            title: my title that will not update
          - url: https://someexample.com
            title: my title that will update

The version of Python you're using

Python 3.9.7

Your operating system

PopOS 21.04

Versions of your packages

Jupyter Book      : 0.11.3
External ToC      : 0.2.3
MyST-Parser       : 0.13.7
MyST-NB           : 0.12.3
Sphinx Book Theme : 0.1.3
Jupyter-Cache     : 0.4.3
NbClient          : 0.5.4

Additional context

No response

joelostblom avatar Oct 10 '21 17:10 joelostblom

Hmmm - I think that the challenge is that Sphinx caches pages and only rebuilds them when the page content changes. In this case the _toc.yml is technically separate from the page content so Sphinx doesn't realize that the page has "changed" in an important way.

I suspect that we should make any changes to _toc.yml force a rebuild of the whole book, do that page titles are correctly propagated to all book pages

choldgraf avatar Oct 10 '21 17:10 choldgraf

I actually thought this was a feature not a bug! Some my notebooks are long so it takes ages to build.

Since I know about this "feature", my workaround when I'm doing this locally is just to trash the _build folder (or add the force flag) to rebuild the whole book.

In production however, this is not an issue, because the GH action that builds the book for me rebuilds it from scratch every time.

firasm avatar Oct 24 '21 19:10 firasm

Well, I always start both commands of

jupyter-book clean -a book
jupyter-book build book

when building jupyter books and even for an empty skeleton bok I have issue #1804.

I found out the tag <h1 class="site-logo" id="site-title"> is not populated with the title I expect to see but this is just a naive observation of someone without knowledge of the implementation of Jupyter Book.

schwabts avatar Aug 12 '22 14:08 schwabts

I'd say this ticket can be closed as the answer is on the jupyterbook page in this section:

https://jupyterbook.org/en/stable/start/build.html#aside-source-vs-build-files

I've also added a footnote for emphasis in the Jupyterbook in PR: https://github.com/executablebooks/jupyter-book/pull/1861

root-11 avatar Oct 24 '22 09:10 root-11

Thanks for clarifying this in #1861 @root-11 - I'll close this one as documented better for now, we can re-open an issue if there's a more specific change that needs to be made

choldgraf avatar Nov 15 '22 09:11 choldgraf