Assigning a Custom Domain to Gitlab Pages

Posted on Jun 28, 2024

In your repository go to Deploy -> Pages and add new domain

Add domain name. Make sure the that Automatic certificate management is activated. Then click on Create new domain button.

Copy the verification status record _gitlab-pages-verification-code.digitalnerd.me TXT gitlab-pages-verification-code=342d3f0bf42fbbb969cfc6e1925a8e08, go to https://squarespace.com and add it as TXT DNS record in DNS Settings section.

Then go back to the Pages Domain page and click Retry verification button. And click the Save Changes button at the bottom of the page.

Now go to Settings -> General -> Visibility and select Everyone as shown in the image below:

Click the Save Changes button.

Now we need to modify the hugo.yaml file.

#baseURL: https://digitalnerd.gitlab.io/
baseURL: https://digitalnerd.me/
languageCode: en-us
title: "Digital Nerd's Blog"
theme: archie
git add .
git commit -m "Changed baseURL for custom domain"
git push

References