0

I'm trying to display all the BOOKS in my site as a teaser block with the pages below it.

Like this:

Title: This is the book of my Cat
Page: 1 2 3 4 5 6 7 8 

Title: This is the book of my Dog
Page: 1 2 3 4 5 6 7 8 

Title: This is the book of my Bird
Page: 1 2 3 4 5 6 7 8 

I have the following View setup to display the teaser of the books on the site filtered by the value of having children or not.

enter image description here

In the teaser of the book I have the "Views Book Pages" block to display the children pages. But I can't seem to get it to show up properly as I think I am using the relationships incorrectly. Or do I use contextual filters? Currently I have the relationship set to "Book Parent", but this still shows all pages of ALL books under each book teaser.

enter image description here

1 Answer 1

0

You don't need Contextual filters if you want to show all items, Contextual filters are used when there is a context that informs Views to narrow down results, for example, a context of a single book, to show pages only from that single book.

In your case you want to show all pages that exist, but group them according to Books they belong to.

It seems like you're using a field reference to connect your Pages to Books, so that is what you use to group the results by.

You already have the Book Parent Relationship, this introduces the Book parent info into this Views, along with the "children" pages.

You also have the Page title Field, that takes care of the Page links. Now you need to make them display with the logic of which book they belong to.

Add the "Content: Title" Field (another one), make it use the Relationship, and it will show the Book title, not the Page title.

Then under Format settings set the first grouping field to the (second) Content Title field, the one for the Book title. You can also set that field to Exclude from display so it's not repeated for every Page, since it will be used as the "grouping" field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.