If you haven’t already looked at the GitBook platform, you definitely should. There are a number of very interesting ways that you can use this for creating easy-to-use documentation sites using simple markdown and the hosted platform. SaaS FTW!
Let’s view a simple way to add a custom domain name to an existing GitBook site. For this example, I’m using:
- A GitBook site – https://www.gitbook.com/book/discoposse/turbonomic-guide-to-the-galaxy
- AWS Route53 hosted zone
- About 15 minutes of wait time for the DNS propagation
Start by looking at your existing GitBook site under the Settings | Domains section:
The first thing to do is to make sure that you get your DNS configured. Open up your AWS Route53 console, select the radio button for your domain, and click the Go to Record Sets button:
Create a new CNAME entry using the Create Record Set button. Choose www for the Name field, CNAME as the Type, and for the value, choose
www.gitbooks.io to redirect the request:
You also need to set a redirect for the root domain which is turbonomicguidetothegalaxy.com in this case. That “naked” domain redirect can be done in some DNS hosting platforms using a URL Redirect, however that is not available with AWS Route53. Luckily, I’ve covered how to use S3 and Route53 for simple redirects in the past here. You will just need to configure the redirect of the root to www.turbonomicguidetothegalaxy.com in the S3 configuration. Route53 will take over from there.
On your GitBooks settings page, enter the newly assigned domain name to match the changes you just made in Route53. This is done using the Domain for content field:
Save the settings and you’ll be given a confirmation on screen:
This is where the wait time comes in. DNS can take a little while to update across all of the internet, so it’s best to wait about 15 minutes to complete the last step.
To confirm your changes, type in the domain name for your GitBook that you have just configured and watch the magic happen! The sample you can see at TurbonomicGuideToTheGalaxy.com is a simple GitBooks site that is being updated. Now all that I have to do is give out the FQDN and update my book as I go. If the book repository is updated, the redirection can be configured at the new repo and you never have to worry about people having to update their links and bookmarks.