How to get hashtags to show up in front of the tags on Tumblr

tumblrtumblr-themes

I'm using the "Feather" theme on Tumblr, which I had to customize in order for it to display tags. The tags are showing up fine on my dashboard, but if I actually visit my blog URL, there is no hash (#) in front of them. This small change is annoying me terribly. Is there anyway to tell the tag system I want it to automatically put a hash there to separate them?

My HTML for the tags is as follows:

{block:HasTags} 
{block:Tags} 
<a href="{TagURL}">{Tag}</a> 
{/block:Tags} 
{/block:HasTags}

Best Answer

Variant 1: in HTML

If you want to include the # before each tag so that it could be copy&pasted, you could add it in your markup:

<a href=”{TagURL}”>#{Tag}</a> 

Variant 2: in CSS

If you only want to display the #, you could use pseudo-elements (CSS):

a::before (content:"#";)

You'd need to use an appropriate selector so that it only adds the pseudo-element to the tag links; if there is no such class or ID, you could add a class to your markup, of course, e.g.:

<a href=”{TagURL}” class="tag">#{Tag}</a> 

so then you could add to your CSS:

.tag::before (content:"#";) 

Variant 3: tags itself

If you want your actual tags to start with a #, you'd need to re-tag your content. But I'd assume that Tumblr forbids the # character in tag names (but there doesn't seem to be any documentation which characters are allowed), so this wouldn't work.


I don't know/understand your exact use case, but I assume that you only need it as visual separator, so you should go with variant 2.