Table of Contents#
Your book’s structure is determined by a Table of Contents. This is a YAML file (called _toc.yml
) that defines a structure that Jupyter Book uses to create the order and nesting of pages.
Structure of a Book#
The table of contents is broadly organized like so:
format: jb-book
root: index
parts:
- caption: Name of Part 1
chapters:
- file: path/to/part1/chapter1
- file: path/to/part1/chapter2
sections:
- file: path/to/part1/chapter2/section1
- caption: Name of Part 2
chapters:
- file: path/to/part2/chapter1
- file: path/to/part2/chapter2
sections:
- file: path/to/part2/chapter2/section1
- chapters:
- file: path/to/chapter1
- url: https://example.com
title: Example website
- glob: sub-folder/other*
Here is a brief explanation of each key:
format:
Defines the structure of this Table of Contents (e.g., how to interpret the key names).
jb-book
tells Jupyter Book to expectchapters
andparts
terminology (see below for details).root:
The first page of your book (aka, the “root page”). It is the landing page for the HTML of your book. All paths for chapters/sections will be relative to this root document.
parts:
A list of entries, each of which defines a chapter. This is useful if you’d like to use different groups of chapters.
chapters:
A list of entries, each of which maps onto chapters of your book.
sections:
A list of entries that define subsections of a chapter. This is useful if you’d like to split a chapter across multiple pages (each making up a section of the chapter). See How headers and sections map onto to book structure for more information.
file:
A path that points to a local text file, which contains the content of this entry (the chapter, section, or sub-section). These paths should be relative to your
_toc.yml
file.glob:
A glob-like pattern that can be used to match against multiple local files. Each of these files will be collected and inserted into your content, in the order that
glob
discovers them.url:
An external link to a website (starting with
http
orhttps
). This will be inserted into your book’s Table of Contents, though it will not affect your book’s structure (like numbering). When atitle:
entry is provided its text is used instead of the full URL.
More Information#
Find more information about _toc.yml
: