I’m trying to retrieve taxonomy data from nested posts within the current post. Specifically, I have a custom post type called ‘book-pages,’ which I use inside a post to represent a book. These ‘book-pages’ are nested posts representing individual pages of the book. Additionally, I have a taxonomy called ‘chapter.’ My goal is to filter chapters from the current post representing a book.
I’m getting duplicating list like if chapter 1 have 4 pages chapter 1 showing 4 time.I’m using timber 2.0 version.Thanks
$context = Timber::context();
Timber::render('views/pages/single-books.twig', $context);
{# i am getting duplicating #}
{% for page in post.children %}
{% for item in page.terms('book') %}
<h2>{{ item.title }}</h2>
{% endfor %}
{% endfor %}