Count items from multiselect into a Info area

Greetings everyone,

I’m using the site blueprint for a list of subpages with some info on each of the cards.

Those subpages have a category system implemented using a multiselect, being populated from a list of page set.

My problem is I can add into the info parameter, the “tags” selected, but it shows “page/subpage”.

What I want is the count of those in integer (ex. 2 items) , but I can’t figure it out.

Any ideas?

Kind regards

info: "{{ page.multiselectFieldName.toPages(',').count() }}"

If that doesn’t work, you need a custom page method.

1 Like

Hi @texnixe and thank you for quick reply.

I’ve tried and it seems that it didn’t work.

info: " {{ page.filterExperiences.toPage(',').count() }} experiences<br>{{ page.filterStays.toPage(',').count() }} stays"

The filterExperiences and FilterStays are like this:

query: site.find('experiences').children
query: site.find('stays').children

Regarding custom page method I don’t follow you, I’m a bit new in this more advanced stuff :sweat_smile:

Thank you

In order to show a bit more of what i have at the moment, here are yml:

 filterExperiences:
        label: 
          en: Choose related experiences
        type: multiselect
        options: query
        query: site.find('experiences').children

      filterStays:
        label: 
          en: Choose related stays
        type: multiselect
        options: query
        query: site.find('stays').children

Here is the yml that i want to list the mix of the 2 above:

listHosts:
        headline:
          en: List of hosts
        parent: site.find("hosts")
        type: pages
        layout: cards  
        create: false
        image:
          ratio: 16/9
          cover: true
          back: black
        info: "{{ page.filterExperiences.toPage(',').count() }} experiences<br>{{ page.filterStays.toPage(',').count() }} stays"

Hope it helps

Sorry, I had a type, should have been toPages(','), of course.

1 Like

Fantastic :pray:…that was it, always learning…thank you so much Sonja.