CMS reference element hidden if appears once

Hello, I’m encountering an issue with displaying a reference only one time in a CMS collection list.

Right now the structure displays

Date 1
Reference title 1
Linked press article 1

Date 1
Reference title 1
Linked press article 2

Date 1
Reference title 1
Linked press article 3

Date 1
Reference title 1
Linked press article 4

Date 2
Reference title 2
Linked press article A

Date 2
Reference title 2
Linked press article B

Date 2
Reference title 2
Linked press article C

Date 2
Reference title 2
Linked press article D

I would like the date and reference title to appear only once and then be hidden, like this:

Date 1
Reference title 1
Linked press article 1
Linked press article 2
Linked press article 3
Linked press article 4

Date 2
Reference title 2
Linked press article A
Linked press article B
Linked press article C
Linked press article D

I’ve tried using two separate CMS collection lists for the ‘Linked press article’ and ‘Date’ and
‘Reference title’ parts but I cannot link them together so it displays the right title

Thanks in advance for the help!


Here is my public share link: LINK
([how to access public share link][2])

hi @Valentinedg

displaying data like that is correct and is is how CMS in WF works. You loop over each document and render data you need.

now to your reqiured design.

There is a several options outside custom code and they are dirty works around. The easies way is:

  1. create 2 sections or whatever
  2. in each section hardcode “date” and “reference title”
  3. in each section add Collection
  4. use references dats you have in your “articles/documents” and use these to filer
    required documents in each Collection.

With this design you will loop over data, filter these and render under your heading (date & reference title)

NOTE: do not use text columns for website Layout as their purpose is set in their name.

Hi Stan,

Thanks for your answer. The problem with hardcoding the “date” and “reference title” is that my client won’t be able to add a new section from the CMS which is my main problem.

Any idea on how it is possible to achieve this with custom code?

Yes, another option can be use 2 Collection items one will be Heading and Sub heading with limit of one item and using a filter. under this use second collection to display documents. Whole thing will be one section. But this is IMO the dirty way as I have mentioned. Too many requests to CMS.

Yes that’s what I initially did but there is no point as the filtering of the second layer of CMS has to be manual anyways. I’ll change my design in the end, thanks for your help!

hi @Valentinedg the structure design you would like to achieve, means let client add a new section dynamically can’t be done without WF CMS API. If you are not a developer you can go some way around.

  1. create page (template) that will hold all informations team will inform what where, how … plus “Linked press article 1 - X” .

  2. on Home page add section with collection that will contain let say “title” and date" this part should be a link to “current article”

So when client will add a new “article” it will be rendered in this section dynamically.

one more thing as I do not know how often will client adding a new data. If updates will be frequent you should will probably include some pagination.

Another option is to include in “article” another switch “field” that allow client decide to choose if “article” is active ( will be rendered) or is inactive (not be displayed on page in list).

You can do that dynamically with custom code to not display past events that will have date higher that “Date”.

These are only some options but I do not know details. :man_shrugging: