Zach Cochran
by Zach Cochran
1 min read



As I mentioned in my post yesterday, I needed to update my github pages blog to start pointing traffic over to this site instead. I didn’t want to just have a static link sitting on the page that would require someone to click it to be redirected. So I went searching for a solution that would allow me to automatically redirect without any interaction.

As I don’t host the github pages site on my own, there’s nothing server side that I couldn’t do with forcing the redirect. So I went looking for a way to handle it with just HTML code that could appear within the generated jekyll code.

My searches let me to finding two options for handling the redirects.

Using a meta tag

The first option is to use a header meta tag to do the redirect. This method allows you to set a timer for when the page will be reloaded, and reload over to a different site:

<meta http-equiv="refresh" content="2; url=" />

In this example, the page will refresh automatically after 2 seconds of visiting the page, and then reload the browser to this blog. Neat.

Using javascript

The second option is to just use some simple javascript to perform the redirect. This can easily be combined with a timeout function to cause the redirect to trigger after n seconds:

<script type="text/javascript">
    setTimeout(function() {window.location.href = ""}, 2000);

This works very similar to the meta tag way, kicking off the redirect after 2 seconds of loading the page.

My implementation

I chose to do three things with my approach:

  1. Use the meta tag
  2. Use the Javascript snippet
  3. Add a static link just in case the redirect doesn’t take place.

If you want to see how it turned out, you can visit back to the old blog at