statamic / v2-hub

Statamic 2 - Feature Requests and Bug Reports
https://statamic.com
95 stars 5 forks source link

Collection:count from="*" returns Zero #2412

Closed Rovaski closed 5 years ago

Rovaski commented 5 years ago

Describe the bug {{ collection:count from="*" }} returns zero.. {{ collection:count from="someCollection|anotherCollection" }} also returns zero.

Expected behavior Expected collection count to return number of entries from either all "*" or the specific pipe delimited collections. Also expected to retain the ability to use all modifiers such as filtering with things like author:is="Barfoo" or title:contains="Foo", and return the correct count of entries matching that criteria.

Environment details (please complete the following information):

jackmcdade commented 5 years ago

We can take a look, but honestly collection:count is kinda superfluous since we added aliasing. You can do this:

{{ collection from="someCollection|anotherCollection" author:is="Barfoo as="entries }}
    {{ entries | count }}
{{ /collection }}

Give that a shot!

Rovaski commented 5 years ago

That works perfectly. Thanks.