How to Use the Drupal Book Module

How to Use the Drupal Book Module

With the Drupal Book module, it is possible to create collections of related pieces of documents presented in a hierarchy. This format is suitable for handbooks and tutorials, for example.

Notice: This module is not for creating ebooks.

The Book module comes by default (disabled) with Drupal core modules, so there is no need to download or install anything additional on your system.

Keep reading to learn how to use this module!

How to use the Drupal book module


Step #1. – Enable the Module

  • Click Extend.
  • Scroll down and enable the Book module.
  • Click Install.

How to use the Drupal book module


Step #2. – The Book Content Type

  • Click Structure > Content types.

There is a new content type in addition to the 2 Drupal default content types called the Book page Content type.

  • Click Manage fields.

How to use the Drupal book module

Add an image field with the default settings.

How to use the Drupal book module

  • Add a link field.
  • Give it proper title.
  • Click Save and continue.

How to use the Drupal book module

  • Set the allowed number of values to unlimited.
  • Click Save field settings.

How to use the Drupal book module

  • Click Manage display.
  • Hide the image label.
  • Rearrange the fields.
  • Click Save.

How to use the Drupal book module


Step #3. – The Book Outline

  • Click Structure > Books.

How to use the Drupal book module

You will be presented with a list of book outlines. At the moment this list is empty, since we haven’t created any book yet.

  • Click the Settings tab.

You have two settings here:

  1. the content types allowed in book outlines (you can select multiple options here)
  2. the default content type (one value allowed) added when you click the “Add page” link
  • Leave default values
  • Click Save configuration.

How to use the Drupal book module


Step #4. – Create a Book

  • Click Content > Add content > Book page
  • Enter a proper title and body text.
  • Add a proper image.
  • Click Book Outline on the right column.
  • Select Create a new book from the dropdown.
  • Click Save.

How to use the Drupal book module

How to use the Drupal book module

When seeing the published node, you will notice an extra tab on the top called Outline.

How to use the Drupal book module

You can click here at any time and rearrange the outline of this particular node within the book hierarchy. This is also possible through the Books outline interface we saw on the step before.

How to use the Drupal book module

Since we have created only the main page of our book, you will not be able to configure anything here.

  • Click Update Book outline.
  • Scroll down to the bottom of the book page.
  • Click Add child page

How to use the Drupal book module

This will take you directly to the Book page edit screen.

  • Add proper content
  • Click Save.
  • Change the weight to -15 (if you will have more than 16 child pages, you will have a problem to place the last one at the end) as a security measure.

As a matter of fact, this is more a quirk, since you can rearrange book pages through a drag and drop interface within the book outline.

How to use the Drupal book module

  • Click Save.

How to use the Drupal book module

Let’s add some more pages to “modelate” the structure detailed on the image. Use the column on the right of each node you edit.

How to use the Drupal book module

How to use the Drupal book module

When you have finished, take a look at the published nodes.

How to use the Drupal book module

Nodes with child pages, will display a list of links containing them. Furthermore you have on the bottom, three additional links. Two of them point to the previous and next articles according to the sequence on the hierarchy.

The link labeled “Up” takes you to the corresponding parent page, that is, one level up.

To check the finished outline,

  • Click Structure > Books > Edit order and titles.

You can rearrange the structure and order of your book here.

  • Click Save book pages after you are finished editing.

How to use the Drupal book module

The book navigation links can be styled through the css class .book-navigation or through its particular id.

How to use the Drupal book module

I hope you liked this tutorial. Thanks for reading!

Author

  • Jorge Montoya

    Jorge lived in Ecuador and Germany. Now he is back to his homeland Colombia. He spends his time translating from English and German to Spanish. He enjoys playing with Drupal and other Open Source Content Management Systems and technologies.

0 0 votes
Article Rating
Subscribe
Notify of
7 Comments
Oldest
Newest
Inline Feedbacks
View all comments
André Angelantoni
André Angelantoni
3 years ago

Good overview. Some folks might be interested that we added a new Book Navigation component to Layout Builder Kit since the built-in one is formatted in a restricted way:
https://www.drupal.org/project/layout_builder_kit

mandclu
mandclu
3 years ago

Great tutorial! If you find the Book module useful but wish the menu for it was more flexible, please check out the [url=https://www.drupal.org/project/custom_book_block]Custom Book Block[/url] module I made. Patches and feature requests are welcome!

Robb H.
Robb H.
3 years ago

Is it possible to have a node exist in two (or more) separate books? Would be very useful.

mikall
3 years ago
Reply to  Robb H.

Sorry to say Robb, but the answer is no.  Each node belongs to one section of a specific book only. 

Thierry D.
Thierry D.
3 years ago

Thanks Jorge ! it’s a great tutorial and very clear !!
It will be wonderful if one day you could do an other one to explain how to display in Drupal 8 the total tree on a page (for navigation), and how to style in different way the tree (the complet one and the childs’one), may be a tutorial with layout builder kit  ?… Have a nice day 🙂

Hemangi
Hemangi
2 years ago

Helpful content.
Is there any way to add more number of FAQs to a drupal website without manually typing it or by copy-pasting??

Dawain
Dawain
2 years ago

Is there a way to add a search feature that only searches the book?

7
0
Would love your thoughts, please comment.x
()
x