Streaming live at 10am (PST)

How to hide a title when there is no CMS item

I have 3 CMS collections (related to this question):

  • Episodes (for a podcast)
  • Books
  • People (Authors/Guests)

Both Books and Episodes have a multi-reference field that allows me to connect them to People.

Now on the CMS Collection page of the Episodes, I show the info of the episode and show the People being interviewed in this episode. See for example https://www.cro.cafe/podcast/nieuw-boek-over-webpsychologie

On this same Episode CMS Collection page, I want to include the books that the guests wrote and maybe also other books that the guests recommend.

Now I can include a new Collection List element to show any book(s) that any of the podcast guests has written. And if there is no book written by any of the guests (resulting in an empty list) I can just remove/hide the message and all is good: a book is shown when there is one, otherwise nothing is shown.

I don’t just want to randomly add book covers on that page, but I’d like to give this section a neat title (and maybe a small description) above that Collection List element.

The challenge now comes with the situations where the guest has no book. The collection list will be empty but the title will still be there. In the Conditional Visibility settings of the title element, there is no way for me (afaik) to filter on if this guest has a book connected to them or not.

Any suggestions on how I can make the title appear/disappear on the condition of a book being connected to the episode guest or not?

(I know I could make a workaround by having a toggle field in the People CMS Collection stating if this person has written a book or not, but that feels very messy and something I like to prevent doing).

Hi @guido,

Can you provide the share link here, if not, send it to me in a DM and Ill take a look for you.

Have a Great Day and Happy Designing,
~ Brandon

1 Like

link sent to you as a DM :slight_smile:

1 Like

Keen to know the outcome of this. Can the answer be shared here please?

Thanks

1 Like

Finsweet has your back guys. Check this out

1 Like

Im afraid I can’t get the video to work. Do you have another link?

There is no need for the video - the tiny bit of code is super easy, check it out on the page lower down.

1 Like

Thx @dram, works like a charm!

1 Like