You cannot filter a single block type but only a collection of blocks, and there is no reason to when you are in your herosection block snippet anyway, since that only refers to this block type.
Iād actually want to do something similar. In my case itās counting the images on an article page and output the count of the figure to the figcaption, so automatically having āFigure 1: abcā, āFigure 2: defā etc.
The CSS counters idea works fine, however is more difficult with internationalization (might somehow work with CSS vars, havenāt tried).
Is there any other way to attach the counter, or more general, additional data to that particular object? Afaik, I cannot change field data.
One way to achieve that would be to loop through the blocks, then in the loop use an if statement that checks if the block type is an image, if thatās the case, you increase a counter and instead of echoing the block, you call the block snippet and inject the counter variable (Blocks | Kirby):