At the end of every post type in my Tumblr theme, I've got this code:
<p class="permalink">
<a href="{Permalink}">{NoteCountWithLabel}</a>
{block:HasTags} # filed under:
{block:Tags}
<a href="{TagURL}">{Tag}</a>
{/block:Tags}
{/block:HasTags}
</p>
(I know the
bit is not exactly a class act. It was my four second workaround, and it's not the purpose of this question, so bear with me!)
On a post with multiple tags, that yields:
If I just add a comma after {Tag}
, making it <a href="{TagURL}">{Tag},</a>
, I get:
The last tag has an extraneous comma, and posts with only one tag would show the extra comma under this method, as well.
How do I add just the right number of commas?
Update:
Jeremy's answer below did what I wanted. But, in an attempt to get fancy be "standards-compliant" (though I don't know why anyone using IE8 would read my tumblr), I attempted to implement w3d's suggestion. So now the CSS looks like:
a.tag:before {
content:", ";
}
a.tag:first-child:before {
content:"";
}
The result is now:
(n.b.: the line break is unrelated - I added that on purpose.)
So. What went wrong?
,
is probably the white-space that occurs after the</a>
in your markup/theme. You could try removing this. The first comma is still present? Try changingcontent:"";
tocontent:"%";
just to see if%
shows? (Although I see from your comment on my answer that this may not have any effect?!)