iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
📄

How to Set Up a Custom Domain for GitHub Pages with Squarespace

に公開

First draft: 2025-12-28
Hiroyuki Komatsu (@komatsuh:bsky, @komatsuh:twitter)

I created a site called charcode.dev.

It is a tool for checking and manipulating the character codes that compose a string. The source code is available on GitHub.

https://github.com/hiroyuki-komatsu/charcode

Since I was at it, I decided to acquire the charcode.dev domain for the web app I'm hosting on GitHub Pages and operate GitHub Pages using that custom domain.

This article is a note on the configuration methods that were necessary at that time.

Steps

  1. Publish on GitHub Pages
  2. Acquire a custom domain
  3. Configure the DNS server settings
  4. Configure the GitHub Pages settings

1. Publish on GitHub Pages

I will publish the index.html located in the root directory of the GitHub repository. Since it is a simple web app, I will use a simple configuration.

  1. Go to Settings > Pages
  2. Select "Deploy from a branch" under Build and deployment > Source
  3. Select "master, / (root)" under Build and deployment > Branch

For newly created repositories, select "main" instead of "master".

Screenshot of GitHub Pages Build and deployment

With this, it will be published at the URL https:// <username> .github.io/ <repository name> / index.html.

In this case, the URL is https://hiroyuki-komatsu.github.io/charcode/index.html.

2. Acquire a custom domain

I acquired a custom domain using Squarespace.

https://domains.squarespace.com/ja/

3. Configure the DNS server settings

Change the Squarespace settings so that the acquired domain points to the page on GitHub Pages.

  1. Add the following under Domains > DNS > Custom records
Host Type Data
@ ALIAS <username>.github.io
www CNAME <username>.github.io

Screenshot of Squarespace DNS settings

There is a setting called "Domain forwarding" on the website, but it was not necessary for this purpose.

Screenshot of Squarespace domain settings

4. Configure the GitHub Pages settings

  1. Go to Settings > Pages
  2. Set the custom domain in Custom domain (charcode.dev in this case)
  3. Check "Enforce HTTPS"

Screenshot of GitHub Pages Custom domain

If configured correctly, the label "DNS check successful" will be displayed.

Summary

GitHub Pages makes it easy to publish web apps. Using a custom domain has further improved convenience.

charcode.dev is useful for checking and editing character codes, so please give it a try.

https://www.youtube.com/watch?v=s3TsS1SaHjQ

GitHubで編集を提案

Discussion