I have this in my pages
-Section:
info: '{{ page.recipients.count }}'
I expected to get the number of items in the recipients fields. But instead the content of the recipients-field ist printed, a yaml list of user IDs.
I have this in my pages
-Section:
info: '{{ page.recipients.count }}'
I expected to get the number of items in the recipients fields. But instead the content of the recipients-field ist printed, a yaml list of user IDs.
You have to convert to users before counting:
page.recipients.toUsers.count
Like you would in a template. You cannot count a field object.
That doesn’t help. The field is a yaml list of User IDs using the relationship-field (plugin). In the content file it looks like this:
Recipients: XzMkX4Cq, C3M5X4Cx
Ah, a comma separated list then, not yaml, then you have to pass the comma as parameter
page.recipients.toUsers(',').count
Wow!