Search code examples
tumblr

Display Tumblr post content differently using tags


I don't know if what I want it's possible or not, but what I'm looking for is a way of displaying content differently, using tags.

If I have a post with a tag #movies, I would want to display an image of a camera. If the tag is #music, I would like to display an image of a radio.


Solution

  • Try this immediately under {block:Posts}, or before {/block:Posts} depending on where you want the signifier to be.

    {block:HasTags}
    {block:Tags}
    <script type='text/javascript'>
    var {Tag} = '{Tag}'; if ({Tag} == 'movies')
    {document.write('Movies blah blah');}
    </script>
    {/block:Tags}
    {/block:HasTags}
    

    This should display the text "Movies blah blah" wherever you put the code on posts you tag with the tag "movies" (case sensitive).

    Simply repeat for other tags.