WordPress on GitHub Pages with HTTrack

and that's how we host our WP. the Baracktocat by @cameronmcefee
and that’s how we host our WP.
the Baracktocat by @cameronmcefee

Static websites is faster than any WordPress installation.
Well, I am tech enthusiast and I love challenges. I’m well aware of Jekyll’s existence, but I love WordPress.
Since my blog doesn’t have any dynamic functions (apart from the comments), I decided to go for it.

There are plenty reasons why you shouldn’t do that, here’s a few:

1. Very difficult to scale;
2. Difficult to edit;
3. Just for static content;


For those who don’t know GitHub Pages, take a look: https://pages.github.com/


  • WordPress Install
  • GitHub Account
  • A Linux Distro (You can do with Windows or OS X as well, but you have to adept the instructions)
  • HTTrack installed
  • Git installed


1. Remove srcset of WordPress and install WidgetPack Comment System;

DISQUS doesn’t work with HTTrack, so you have to use WidgetPack (remember to configure it).

2. Create a GitHub repo similar to “yourusername.github.io”;
3. Check if you have git and httrack installed. If you don’t, just install with the software package manager of your distro;
4. Create a file called “wp2git.sh” in your home folder and put the following code:

5. Edit the DOMAIN and REPOSITORY variables.

The DOMAIN is the URL of the WP Installation.
The REPOSITORY will be the URL you use to clone via SSH.
Edit BRANCH to github-pages if it isn’t your first GitHub Page.

6. Open the Terminal and run “bash wp2git.sh”;

You must have Git configured: https://help.github.com/articles/set-up-git/

7. Now, access your GitHub Page and see if it’s okay.

When you update your WP, just run the script again and it’ll do the trick. That’s a simple and powerful way of blogging.

1. I’m using CSE for internal search, but you can use any external search engine to substitute the WP search system;
2. You can use the same domain for WP and GitHub Pages, but you have to edit /etc/hosts to manage the WP and use a proxy to see your GitHub pages. You’ll also need to have a CNAME file with the domain, as GitHub docs says;
3. If you use another dynamic script, you can uncomment the “REPLACE DYNAMIC ELEMENTS”, create the file “dynamic.txt” with the dynamic script and then put “<div id=”dynamic-element”></div>” where the script should be in your WP installation;
4. You can put CloudFlare or Cloudbrick on the line to have a free SSL on your GitHub Page.