template/book/exercises/005a.md
2025-06-02 17:20:12 +02:00

109 lines
2.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Exercise 6: Reuse content from another book
So far, you've been working inside your own book. But what if someone else has already written a page you’d like to reuse? Instead of copying it, you can **include it directly** into your own book using the [TeachBooks Recombiner](https://teachbooks.io/recombiner/).
\::::::{topic} Exercise objective
Can you include a page from someone else’s book into your own using the Recombiner?
\::::::
1. Open the [TeachBooks Recombiner](https://teachbooks.io/recombiner/).
2. Select the book and chapter(s) you want to reuse:
* Click on the book (e.g., **TeachBooks Manual**).
* Browse the chapters and click the `+` button to select the ones you want (e.g., **Collaboration in GitHub**).
3. Click **Show how do it yourself instructions**
4. Follow the instructions provided:
* Copy the external link (it will look something like this):
```yaml
- external: https://github.com/TeachBooks/manual/blob/v1.1.1/book/workflows/collaboration.md
```
* Paste it into the `parts:` or `chapters:` section of your `_toc.yml` file in your book repository.
* Save the changes, commit, and push them.
\::::::{admonition} Example: `_toc.yml` snippet
```yaml
format: jb-book
root: intro
chapters:
- file: 001
- external: https://github.com/TeachBooks/manual/blob/v1.1.1/book/workflows/collaboration.md
- file: 003
```
\::::::
5. When you are ready, commit your changes to the repository by clicking on the green `Commit changes` button.
6. Add a commit message.
7. To see your changes, go to {octicon}`play` `Actions` - The most recent workflow run `overview.md / 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).
8. 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, make sure you understand:
* What is the benefit of linking to an external page instead of copying it?
* How does using the Recombiner simplify adding external content?
\::::::