How to add Custom Domain to GitHub Pages Blog

You decided to go with the GitHub pages for your blog and now you want to start writing your first post about some cool new technology you just learned about.

You can’t wait to share it with your friends and followers on Twitter, LinkedIn, Medium, and Facebook.

Then it hits you, the current domain name you have is underwhelming. In the previous post, we set up the site with the default repository name.

You think to yourself I’m a professional I don’t want to share it like that!

So you run out and get your super awesome domain name from GoDaddy for .99¢ and are stumped as to how you get it working with your new blog.

You have come to the right spot because I will walk you through the steps to add your custom domain to your GitHub Pages Blog site.

Let’s do this

Now it’s time to give your site that professional look.

This will be a quick process to complete!

  • Configure DNS settings for a custom domain
  • Update the Blog settings
  • Update the _config.yml file
  • Verify the Blog is using the custom domain

Configure DNS settings

You need to go to the company that you bought the domain name from and change the DNS settings.

Since the admin pages will look different from other providers you may need to find the help documentation on their site.

This is what the GoDaddy DNS Management page looks like when it is all configured.

DNS Settings

Here is how you will create each of the A records. When making DNS changes it could take as long as 24 hours for them to be established.

DNS Record

Make sure there is the CNAME record to allow users to reach your site when they use the www domain prefix.

DNS CNAME Record

Update Blog settings

This step is crazy simple!

Go to the settings tab for the repository and enter in your Custom domain name.

Then click the Save button.

Repository Settings Tab

Update the _config.yml

In the main configuration file, _config.yml, you have to update the url and prod_url values.

_config.yml changes

Verify the Blog

You will want to make sure the blog built successfully before trying to load it in a browser.

Step 1.) Click the Settings tab. Step 2.) Scroll down to the GitHub Pages section. You may see the site is ready to be published message. This means it's building. Step 3.) When successfully build you will see a message that your site is published. Click the link to your blog. Step 4.) Very your site loads and that the changes you made to the _config.yml are correct.

Parting Thoughts - Commit to Content

Now that you have the custom domain added to your GitHub pages blog you are ready to confidently share your site with everyone you know!

Sharing your goals with others is a great way to help hold yourself accountable. The fact that you told your friends and family what you plan on doing you will be more likely to follow through.

Set a day each week to write one blog post. Get in a routine for a couple of months, then try to increase how many you are writing a week.