zola/docs/content/themes/book/index.md

77 lines
2.1 KiB
Markdown
Raw Normal View History

2018-02-23 17:05:46 +00:00
+++
title = "book"
description = "A book theme inspired from GitBook/mdBook"
template = "theme.html"
date = 2022-02-09T00:41:54+05:30
2018-02-23 17:05:46 +00:00
[extra]
created = 2022-02-09T00:41:54+05:30
updated = 2022-02-09T00:41:54+05:30
repository = "https://github.com/getzola/book.git"
2018-11-17 17:27:48 +00:00
homepage = "https://github.com/getzola/book"
minimum_version = "0.5.0"
2018-02-23 17:05:46 +00:00
license = "MIT"
2018-11-17 17:27:48 +00:00
demo = "https://zola-book.netlify.com"
2018-02-23 17:05:46 +00:00
[extra.author]
name = "Vincent Prouillet"
2018-11-17 17:27:48 +00:00
homepage = "https://www.vincentprouillet.com"
2018-02-23 17:05:46 +00:00
+++
# book
A theme based on [Gitbook](https://www.gitbook.com), to write documentation
or books.
![book screenshot](https://github.com/Keats/book/blob/master/screenshot.png?raw=true)
## Contents
- [Installation](#installation)
- [Options](#options)
- [Numbered chapters](#numbered-chapters)
## Installation
First download this theme to your `themes` directory:
```bash
$ cd themes
2018-11-17 17:27:48 +00:00
$ git clone https://github.com/getzola/book.git
2018-02-23 17:05:46 +00:00
```
and then enable it in your `config.toml`:
```toml
theme = "book"
2018-08-04 11:15:01 +00:00
# Optional, if you want search
build_search_index = true
2018-02-23 17:05:46 +00:00
```
2018-08-04 11:15:01 +00:00
## Usage
Book will generate a book from the files you place in the `content` directory. Your book
can have two levels of hierarchy: chapters and subchapters.
Each chapter should be a `section` within the Gutenberg site and should have an `_index.md`
file that sets its `weight` front-matter variable to its chapter number. For example,
chapter 2 should have `weight = 2`. Additionally, each chapter should also set the
`sort_by = "weight"` in its front matter.
Each subchapter should be a `page` and should have its `weight` variable set to the subchapter
number. For example, subchapter 3.4 should have `weight = 4`.
Finally, you should create an `_index.md` file and set the `redirect_to` front-matter variable
to redirect to the first section of your content. For example, if your first section has the
slug `introduction`, then you would set `redirect_to = "introduction"`.
2018-02-23 17:05:46 +00:00
## Options
### Numbered chapters
By default, the `book` theme will number the chapters and pages in the left menu.
2020-12-14 19:47:32 +00:00
You can disable that by setting the `book_number_chapters` in `extra`:
2018-02-23 17:05:46 +00:00
```toml
2020-12-14 19:47:32 +00:00
book_number_chapters = false
2018-02-23 17:05:46 +00:00
```