Hello! I’m a PHP newbie, hoping you guys can help me with this.
Been searching the forum but I haven’t found how to add an extra space after each comma in the tag string.
I’m sure it’s stupid simple but I can’t seem to figure it out.
Thanks for your input! 
Seems that your are echoing the tags as a single string. Usually, you separate the strings by using the split()
method, which gives you an array of tags you can then loop through. Afterwards, we re-add the commas via CSS.
In your templates:
<?php $tags = $page->tags()->split(); ?>
<ul class="tags">
<?php foreach($tags as $tag): ?>
<li><?= $tag ?></li>
</ul>
<?php endforeach ?>
In your css:
.tags li:not(:last-child):after{
content: ", ";
}
1 Like