Counting and combine Tags in Tag Fields with same content


i want to display and count tags with the same content.

For example, i have 3 subpages:
All have a tag “color”.
Two have also a tag “brand”.
One has also a tag “size”.

The the outcome should be: Color=3, Brand=2, Size=1

Any suggestions how to achieve this?

You can use pluck() to get an array of all tags and then loop through this array and filter/count the pages with this tag like this:

$tags = page('parentpage')->children()->pluck('tags', ',', true);
foreach($tags as $tag) {
  $count = page('parentpage')->children()->filterBy('tags', $tag)->count();
  echo $tag . ': ' . $count;

that was fast and i think that will work for me, thx a lot