Overview
This tag's only purpose is to fetch the number of the entries in a collection that match your set of filtering parameters without the need for a tag pair/loop.
Example
There are {{ collection:count in="pogs" }} pogs in this site.
{{-- Using Antlers Blade Components --}}There are <collection:count in="pogs" /> pogs in this site. {{-- Using Fluent Tags --}}There are {{ Statamic::tag('collection:count')->in('pogs') }} pogs in this site.
There are 6201 pogs in this site.
You could do the same thing inside a regular collection tag by aliasing the results to a single variable and using the count modifier.
{{ collection:blog as="entries" }}There are {{ entries | count }} pogs in this site.{{ /collection:blog }}
<statamic:collection:blog as="entries">{{-- This example calls the ->count() method on a Collection instance. --}}There are {{ $entries->count() }} pogs in this site. {{-- This example uses the count modifier. --}}There are {{ Statamic::modify($entries)->count()->fetch() }} pogs in this site. </statamic:collection:blog>
Parameters
in|from
The collection in which to count entries.
*
All parameters available on the collection tag are available.