Score:0

Displaying all pages in a BOOK teaser block within a block

kr flag

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

Score:0
mx flag

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.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.