I can’t crack this one alone, perhaps you have a better idea?
I’d like to display multiple authors on a blog post. This is set up as multi-reference field in the CMS (Blog-Post > Authors). What I would love to achieve is a header that says “Written by Author 1, Author 2, Author 3” (see image). Unfortunately, I cannot see a way to exclude the comma, from the last instance of the collection item.
I have tried overriding the styling using custom code, but not succeeded. e.g. Tryit Editor v3.7
<style>
.seperator-hidden-last:nth-last-child(1 of .collection-item-7) {
background: red;
}
</style>
I typically opt for the latter option in my projects as it’s not something a client normally needs to update and then you don’t have a rogue hidden element on the last item in the list.
I didn’t mention this in my initial reply since you were spacing the items out from one another with margin, but you can add spaces as needed in the content value and prevent them from “collapsing” by changing the Breaking style property in the Designer:
Just keep in mind that you’ll also probably want to clear any spacing you have set on the Collection Item 7 element as the spaces within the pseudo elements will handle that for you