Categories is used as a multi-reference in both Academy and News as they share the same Categories.
I used CMS combine + load + sort + filter to be able to create a homepage to the Blog (with Academy + News) but now, on the template pages for News and Academy, I would need to display the Category CMS (that’s easy and done) but I also need to show the count of articles across both News and Academy for said category.
For a moment I considered doing the opposite aka having 2 multi-reference within the Category CMS but that would complicate the whole process for the marketing team, so that’s kind of a no-go. I also tried CMS nest, but failed.
I’m just lost to how to actually execute on this, would anyone have an idea on how to display such count?
You mentioned CMS Load which suggests you have > 100 items, and that sort of breaks everything. How many categories do you have?
The only client-side build I can think of using native WF structures is…
Category CMS page contains hidden collection lists. e.g. 10 collection lists for News, ranged 1-100, 2-200, etc. and filtered to Category = current category.
Same setup for Academy.
That gives you max 1000 News and 1000 Academy items per Category, if you use all 20 collection lists for this part. A script fetch makes it easy to query each category page, and count those- you can generate;
News item count for category X
Academy item count for category X
and combined, of course
For N categories that means N fetches so I’d cache this at least in session storage so you’re only hit once per visit. I have a cache operator somewhere in SA5 libs, which allows you to package that whole process into an cached async call.
Two other approaches, which are likely more complex-
FS libs have an API which might give you access to some of that data during the load process. Unfortunately you’d need to add CMS next, and figure out how to extract and tally the data as Load and Nest are working.
For a high-performance site, I’d do this all server-side. That means essentially creating lightweight db somewhere, populating it, and then updating it automatically whenever News or Academy CMS tables are updated using Webflow’s API webhools. A lightweight sync, only of the category info really. Then you can either query it or maintain a running total. This would be an unusual build, but I’d personally choose Cloudflare workers for the webhook handlers, D1 for the database, and another worker to expose the data to your pages. You can use a reverse proxy setup if you want that data silently injected into the page with no fetch, as a JSON data block.