Search code examples
htmltumblr

possible to make tumblr 'tagged/(tag)' page custom layout?


I was wondering if there was away to make the 'tagged/(tag)' pages for tumblr a different style than your main theme, according to the tag.

for example if someone goes to 'tagged/green' on my blog, the background would be green, and at 'tagged/blue' the background would be blue, but preferably with more customizeable options. i dont know if theres a way to do this in the main code, but i would also think it could be achieved by creating a custom page and somehow importing the tagged posts (which i haven't been able to successfully do)

any ideas?


Solution

  • https://www.tumblr.com/docs/en/custom_themes#tag-pages

    You'll want to use {tag} as some sort of id within your template HTML (<body id={Tag}> or something like that). This way you can then use css to alter only elements within a page with that id (note that will not work if the tag gets typoed when you post). You could also use it as a class on multiple elements too, with the same result, but I'm not sure if that leaves the literal "class={tag}" in your code, so I'd put that within {block:TagPage} tags.

    If it's literally only the color thing, then you could just have something like this in your css:

    {block:TagPage}
    .{tag} {background-color: {tag};}
    {/block:TagPage}
    

    I'm not entirely clear what happens if the tag is a multi-word tag (specifically, I have no idea if classes generated from a multi-word {URLSafeTag} would be valid html since I don't remember offhandedly what happens to characters that aren't alphanumeric)