⚠ Desculpe pela bagunça aqui, eu estou atualizando meu tema então algumas coisas ficarão fora do lugar por um tempo, mas logo logo voltarão ao normal.

⚠ Sorry for the mess in here, I'm currently updating my theme so some things will be out of place for a while, but soon it will be back to normal.

segunda-feira, 15 de abril de 2019

How to select which posts to show in your fisrt page (Tumblr)

How to select which posts to show in your fisrt page (Tumblr)

(Last updated in 15/04/2019) - (Versão em Português deste tutorial aqui!)

If, like me, you like your blog to look organized, but at the same time like to reblog a little bit of everything and it ends up messing with the appearance of your blog, you must have already thought "how good it would be if I could hide posts that I reblogged because I liked, but that don't match the aesthetic of my theme very well"... Another similar situation would be if you'd like to hide reblogged posts and show only your original posts in the first page.

Well, that would be possible to do using two different logics based in the use of tags. Let's say that you tagged some of your posts with "#photo", you could make your theme:

  • Method 1) Show only the posts that contain the tag "#photo";
  • Method 2) Or, show all posts, except fot the ones that contain the tag "#photo".

I've tried a couple times to use the method 2, but, unfortunately, I still can't make a script that execute this function without messing up with the entire theme. So, for now, the only available option that I know is the method 1, and that's the one I'll be teaching you to use in this post.

How does it work?

You'll install a script in your theme that will make the first page of your blog redirect to a tag page of your choice (if you don't know how to use/access tags, read these articles); this way, when anybody open your blog, the first posts they will see will be the ones tagged with this specific tag.

The posts that are not tagged with this tag can still be accessed through their respective tags (if they have any) and/or through the Archive page of your blog.

If you don't know about the Archive page, simply type "/archive" in front of your blog's URL, for example:

https://anyhs-themes.tumblr.com/archive

And this will take you to a page where you can see the history of posts of your blog:

Tutorial:

If you're not familiar with editing themes:

If you still don't know the search bar from Tumblr's HTML editor, go to the Customize page of your blog and click on “Editar HTML” to open the HTML of your theme. Click anywhere in the code (only to select/focus the code "window", 'cause otherwise it won't work) and press CTRL+F (or Command+F). And this tab will appear at the top of the code:

image

Throughout the tutorial I'll be talking about some codes that you need to find in inside the HTML of your theme. You can use this search bar to find them more easily.

Scripts:

Paste this before </head>:

<!-- Show tag as first page (by www.anyhs-themes.tumblr.com) -->
{block:HomePage}
<script>document.location.assign("/tagged/YOUR_TAG");</script>
{/block:HomePage}
<!-- Show tag as first page (by www.anyhs-themes.tumblr.com) -->

Once you pasted this script in the HTML of your theme, replace "YOUR_TAG" with the name of the tag you want to be shown as your first page. For example: if you want to show as your first page the posts that you tagged as "#mine", so you must type "mine" in that part of the script, like this:

[...]
<script>document.location.assign("/tagged/mine");</script>
[...]

Removing tag page message:

In some themes, tag pages show a message saying something like "Showing 68 posts with the tag #tutorial":

After you define a tag page as your first page, depending on the theme you use, this message can be shown in your first page. It's possible to remove it if you want to. But because it's impossible for me to know how every theme that exist was built, I can't guess how to remove it in your theme — if you're not using a theme that was made by me — without taking a look in its code.

But I know my codes, so if you're using one of my themes, here is how you can do it:

To remove that message from all tag pages of your blog, paste this before </style>:

#tagsPage_msg {display:none;}

To remove that message only to your new first page, paste this before </body>:

<!-- Remove tag message from a specific tag page
(by www.anyhs-themes.tumblr.com) -->
<script>if(document.location.pathname == "/tagged/YOUR_TAG") {document.getElementById("tagspage_msg").style.display="none";};</script>
<!-- Remove tag message from a specific tag page
(by www.anyhs-themes.tumblr.com) -->

And replace "YOUR_TAG" with the name of the tag to which the message should not be shown.


  • If this tutorial was useful to you, please, like or reblog it on Tumblr (here);
  • If you have any question or problem with this post, you can contact me here.