Search code examples
javascripthtmlcsstumblr

Is there a way to change a style/html on a specific tagged page on Tumblr blog?


I have a pretty good understanding of HTML & CSS, but I am having trouble with the Tag Page feature of tumblr. On my blog for every tagpage, I have a heading being grabbed from the name of the tag. I do not want to change the URL. I want to change the heading on the page, but that heading is being grabbed from the {tag}. The tag is vld. Instead of the page saying vld, I want it to say "All Designs". Pretty much overriding the {tag} for just the /tagged/vld tagpage. The TagPage code is:

{block:TagPage}
        <div class="tagtitle">{tag}s</div> 
        {/block:TagPage}

For /tagged/vld, I want the heading on the page to be "All Designs" instead of "vld". how can I make this change for this specific tagpage?

I have tried

{block:TagPage}
   <div class="tag" id="{Tag}">All Designs</div>
{/block:TagPage}

My code being:

{block:TagPage}
   <div class="tagtitle" id="vld">All Designs</h2>
{/block:TagPage}

I have also tried

<script>
switch(window.location.pathname) {
case "/tagged/vld":
            $('.tagtitle').text('All Designs');             
            break; 
  }
});
</script> 

But neither of the methods have worked - everything is still showing the tag as the heading. You can see my blog at vintagelovedesigns.tumblr.com


Solution

  • OK, I have a test version working here using one of your themes:

    https://madox-test.tumblr.com/tagged/vld

    Your switch statement should be throwing an error as you have an additional closing bracket.

    The script should look like this:

    <script type="text/javascript">
    $(document).ready(function(){ // if you are using jquery it is a good idea
       // to wrap code in a document ready function
    
        switch(window.location.pathname) {
            case "/tagged/vld":
            $('.tagtitle').text('All Designs');
            break;
        };
    
    });
    </script>
    

    Hope this helps.