How to display number of items in a collection

Hi. I am building a copy of this site https://mcveaghfleming.businesscatalyst.com/articles in Webflow.

On the right side of that link there’s a list of names, each name is an author and the number along-side is the amount of articles by the author.
In the Webflow build the content is managed by 2 collections, one for the article and one for a list of authors, they reference each other. Is there way of getting this number dynamically from the collections managing the article/author content? I haven’t been able to find a way to do it.

Cheers
Grant


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

Hi @grantsenior

This might help:

1 Like

Thank you. I’ll try it.
Cheers.
Grant

2 Likes

Thanks, I got that to work in a simple setup, so, cool.
Now to see if I can get it to work in the more complex situation.
Cheers
Grant

2 Likes

That’s awesome! :smiley: Happy designing :webflow_heart:

Glad you got it to work, brilliant bit of functionality

How would this work for when there is a page with multiple CMS categories, and you are trying to show how many CMS entries exist within a category?

e.g. page with 10 categories, each with different amounts of posts within them.

I am currently achieving this through having a CMS collection, but want to display how many items exist within that category.

Any help much appreciated :slight_smile:

1 Like

Hey Alastair, did you have any luck with this?

I’m trying to tackle a similar problem, but I need to count how many multi-reference items have been selected within individual CMS items…

e.g. This blog post has [6] tags.

Hope you had better luck than me :sweat_smile:

I actually didn’t, no. But I would be interested to hear if you find a solution :slight_smile:

Not yet, unfortunately. I’ve posted around a bit also. In the meantime, I’ve just added another number field which I manually update when I add a new multi-ref to the item… Not a long-term solution and not scalable.

I’ll let you know if I come across a real solution!

I think this is also very error prone.

To bad Webflow hasn’t have this feature yet.

1 Like

I managed to do this correctly for my site, but it’s counting TOTAL blog posts, not blog posts per category. Does anyone know how to set it up to count by category and not total?

https://preview.webflow.com/preview/ossiamarketing?utm_medium=preview_link&utm_source=designer&utm_content=ossiamarketing&preview=bc163e6c393164efbc45a6854509d8ff&pageId=5f2867e056d9472f30999708&mode=preview

2 Likes

I realized I didn’t have the right solution before, but I did find the solution here: Count and display the amount of items in a Webflow Collection List

It worked for me, but it’s only counting the total number of collection items, not the number of collection items that show under each collection list. I’m hoping someone can help me figure this out!