Search code examples
javascripthtmlcsstumblr

Problems at redirecting specific pages in Tumblr


What I need to do is redirect my main tumblr blog to a static homepage. So that when someone goes to my blog is redirected to the static homepage instead of all the posts.

The process of redirecting might seem like making it harder than it needs to be, but other solutions have not worked. I was able to do the static homepage by changing other parts of the code (without the need of redirecting pages) but it made all the posts disappear, even when looking at their tags. (See more detail into this solution I tried in this question)

So since that doesn't work, all I can think of now is to redirect my tumblr to another one to be the homepage. The new tumblr blog with the static home page is "no-poo-es-inicio.tumblr.com" and the links in the navigation bar go to the actual tumblr blog where I will be posting. (This new blog has the code that created a static homepage and hid all the posts)

To do the redirecting I have tried:

<script type="text/javascript">
if(location.href == 'http://no-poo-es.tumblr.com');
location.replace('http://no-poo-es-inicio.tumblr.com');
</script>

And it works at redirecting, but it redirects everything that starts with my blog url, meaning "no-poo-es.tumblr.com/tagged/foto" or "no-poo-es.tumblr.com/post1" are also redirected to the new url, which I dont want since the new url is only supposed to be the homepage.

I need to find a way so that only my blog url is redirected, but when it has anything added afterwards it won't redirect.

Don't know much about coding so if you have a solution that is not html or javascript, can you also tell me which code to add to install whatever needs to be installed, if even, and how to properly write it in the html code. Thank you very much in advance.


Solution

  • Tumblr has help for this here.

    Otherwise, I'm unsure whether Tumblr will have user-support for JS redirection.