mirror of
https://github.com/TeachBooks/template.git
synced 2026-11-12 22:25:52 +00:00
56 lines
No EOL
2.6 KiB
Markdown
56 lines
No EOL
2.6 KiB
Markdown
# Exercise 2: Add a new file to the table of contents
|
|
|
|
Let's continue by adding one additional step. Let's add a file to the table of contents! the `_toc.yml` contains a list of all the files to be shown in your book-website. Let's add a file which is not in the table of contents yet!
|
|
|
|
::::::{topic} Exercise objective
|
|
Can you add the file named `file_to_be_added_to_toc.md` to the book website?
|
|
::::::
|
|
|
|
1. Go to the {octicon}`code;1em` `Code` - `Book` directory of your GitHub repository and find the location of `file_to_be_added_to_toc.md`
|
|
2. Go to the the file `book/_toc.yml` on your GitHub repository - {octicon}`code;1em` `Code` - `Book` - `_toc.yml` - {octicon}`pencil;1em` `Edit this file`
|
|
3. Add `file_to_be_added_to_toc.md` as a second subpage under `some_content/overview.md`. `some_content/text_and_code.ipynb` is the first subpage.
|
|
|
|
````{admonition} Need some help?
|
|
:class: tip, dropdown
|
|
Your `_toc.yml` should look like
|
|
```yaml
|
|
format: jb-book
|
|
root: intro.md
|
|
|
|
parts:
|
|
- caption: Contents
|
|
chapters:
|
|
- file: some_content/overview.md
|
|
sections:
|
|
- file: some_content/text_and_code.ipynb
|
|
- file: file_to_be_added_to_toc.md
|
|
- file: exercises/exercises
|
|
sections:
|
|
- file: exercises/001.md
|
|
- file: exercises/002.md
|
|
- file: exercises/003.md
|
|
- file: exercises/004.md
|
|
- file: exercises/005.md
|
|
- file: exercises/006.md
|
|
- file: references.md
|
|
- file: changelog.md
|
|
- file: credits.md
|
|
```
|
|
````
|
|
4. Click `Commit changes`
|
|
5. Add a message and description of your change
|
|
6. Select `Commit directly to the main branch` (this adds your change your change to the default version instead of making a new one)
|
|
7. Click `Commit changes`
|
|
8. Go to {octicon}`play;1em` `Actions` - The most recent workflow run `Update _toc.yml / the commit message of the commit you just made` - Wait for it to finish - In the summary, click on the link of your book shown in the table `Branches deployed` and under `Primary book at root` (getting bored of waiting? There'll be exercising on doing this locally which prevents you from waiting)
|
|
9. Do you see your change? If you don't see it click `CTRL`+`F5`/`Control`+`F5`to refresh the page.
|
|
|
|
```{admonition} Check your understanding
|
|
:class: note
|
|
|
|
Before moving on to the next exercise, make sure you understand the following:
|
|
- Are all files in the repository added to the website?
|
|
- What is the purpose of the `_toc.yml` file?
|
|
- What happens if a file is not listed in the `_toc.yml`?
|
|
- How can you verify that your changes to `_toc.yml` were successful?
|
|
- Does the structure of the `_toc.yml` file need to match the directory structure of the repository?
|
|
``` |