0
  1. I use the Book module to create books with chapters.
  2. When I use the default twig template node.html.twig to display a book chapter, a section titled "Book traversal links" is included, with links to the previous chapter, the next chapter, and to the book. The debugger says these links come from the book-navigation.html.twig template.
  3. Instead of the default template, I'm using a custom twig template node--chapter.html.twig to display chapters.

QUESTION:

How can I get the same book traversal links onto my custom page?

NOTES:

  1. I checked for a block containing the book traversal links that I could just insert in my twig template, but I don't see one.
  2. I have checked the $variables array in the twig template to see if maybe a list of the chapter's siblings is already there, but don't see one.
  3. I'm already using HOOK_preprocess_node(&$variables) to find the book parent book's id, so I can use it to find the chapter's siblings, if that's the way to go.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.