Update on June 7, 2018: I’ve moved my website over to GitLab pages from GitHub pages. On the way, I got a pleasant surprise with the integrated CI/CD, which made it really easy to replace my release script (shown below) with a job configuration that handles build and release in the same repository, nice and easy. So to make an update all I have to do now is push to git.
This website used is hosted on github. It’s free, fast and reliable. You can only host static websites on github, but that’s not an issue if you use static site generator like Jekyll, or if you, like me, prefer using Haskell, there’s Jekyll’s good twin Hakyll.
To redirect your custom domain to the github page, you need to lookup the DNS for A Record IP, using either dig
command or online DNS lookup tool. Then use the IP address you found to create A Record for your domain. Consult the github documentation if you need more details.
To redirect the github page to your custom domain create a CNAME file in the github pages repo and put your domain name in it.
It is handy to create a one-click publish shell script. Here is mine:
#!/bin/bash
# Create _publish directory if it doesn't exits
mkdir -p _publish
cd _publish
# Clone the giuthub page repo or pull the latest version
if [ ! -d "tzemanvic.github.io" ]; then
git clone https://github.com/tzemanvic/tzemanvic.github.io.git
else
git pull origin master
fi
cd tzemanvic.github.io
# Prepend the file names you want to keep in here with dot
mv CNAME .CNAME
mv README.md .README.md
# Clean up
rm -rf *
# Undo the name changes
mv .CNAME CNAME
mv .README.md README.md
# Hakyll by default generates site into _site directory
cp -rf ../../_site/* .
# Add all files to git
git add --all :/
git add -u :/
echo -n "enter commit message: "
read msg
git commit -m "$msg"
# If you are using cygwin, git push command will get stuck, so use the following
# command first to cofigure git to ask for password in a popup window
# git config --global core.askpass "git-gui--askpass"
git push origin master