Before proceeding further, make sure you read and completed the [guide on how to use Hero and mdbook](https://git.ourworld.tf/tfgrid/info_tfgrid/src/branch/main/docs/hero_mdbook_fullvm.md).
Let's go through all the steps to create a new mdbook. We will call our book `new_mdbook`.
### Cloning the mdbook Repository
For this guide, we will add a book to `info_tfgrid`. For this reason, we first start to clone the repository. Note that this step can be done automatically by Hero, but it might be easier to do it manually for later steps, such as pushing changes with git.
Once we've cloned the repository, we can make changes to the repository and then push it to `git.ourworld.tf` when we're ready.
Before creating the new mdbook, let's have a look at how the overall directory tree will look like.
### Directory Tree Example
We first show the directory tree template to give an overview of the project. Without taking into account the other mdbooks within the repository, the overall directory tree would look like this:
```
├── books
│ └── new_mdbook
│ └── SUMMARY.md
├── collections
│ └── new_mdbook
│ ├── .collection
│ ├── new_mdbook_example1.md
│ └── new_mdbook_example2.md
└── heroscript
└── new_mdbook
├── book_collections.md
├── context.md
└── sshkey.md
```
### Files and Directories Example
Hero uses three main directories to build an mdbook `books`, `collections` and `heroscript`. Let's have a look at each of them.
-`books`
- This directory contains the file `SUMMARY.md` of every mdbook. Each summary file is within the proper mdbook directory (here we have `new_mdbook`).
- In our case, we will have `books/new_mdbook/SUMMARY.md`.
- The summary file will point to the markdown files we want our mdbook populated with.
- We note that the SUMMARY.md file needs to point to a directory contained within the `collections` directory, as shown just below.
```
- [Example 1](new_mdbook/new_mdbook_example1.md)
- [Example 2](new_mdbook/new_mdbook_example2.md)
```
-`collections`
- This directory contains all the markdown files needed to build all the books in the repository.
- In our case, we will put two markdown files:
-`collections/new_mdbook/new_mdbook_example1.md`
-`collections/new_mdbook/new_mdbook_example2.md`
- There also needs to be a file within that directory called `.collection`. This file should be empty.
```
touch .collection
```
-`heroscript`
- This directory contains three files that are necessary for Hero to build the mdbook, `book_collections.md`, `context.md` and `sshkey.md`
-`context.md` sets the proper configuration for the mdbook using the command `configure`
- This file is the same throughout all the `info_tfgrid` repository.
```
!!books.configure
buildroot:'~/hero/var/mdbuild'
publishroot:'~/hero/www/info'
install:true
reset:false
```
-`sshkey.md` contains the private SSH key
- This file is the same throughout all the `info_tfgrid` repository.
If you're using a remote VM for Hero, you can run the following line to see the book on your local browser. Check the [Hero Full VM guide](https://git.ourworld.tf/tfgrid/info_tfgrid/src/branch/main/docs/hero_mdbook_fullvm.md) for more information on this.
Once you've set the files and directories for your new mdbook and that you are satisfied with the result, you can push the changes to `git.ourworld.tf`.
```
git add .
git commit -m "added new book to info_tfgrid"
git push
```
## Generating the mdbook from a Remote Repository
Once the changes are uploaded to the remote repository, you will be able to build and open the new mdbook using the remote repository URL: