The official documentation for adding a custom domain to gitlab pages is here.
The process is pretty straight forward. I use Gandi as domain name registration service and I had a little hiccup on the registration so I am posting the relevant sections here:
@ 10800 IN A 18.104.22.168 @ 10800 IN TXT "gitlab-pages-verification-code=0000000000000000000000000000" djiamnot.xyz 10800 IN CNAME djiamnot.gitlab.io. www 10800 IN CNAME djiamnot.gitlab.io.
Let's use letsencrypt via acme.sh because we like to have it easy.
git clone https://github.com/Neilpang/acme.sh.git cd ./acme.sh ./acme.sh --install
Generate a Gandi API key (admin->Security section)
export GANDI_LIVEDNS_KEY="ffffffff00000000" acme.sh --issue --dns dns_gandi_livedns -d djiamnot.xyz
Then copy the generated fullchain.cer to GitLab's pages certificate field and your .key to the private key field.
This should do it but you may have to wait a while before it kicks in. Don't forget to change your Nikola configuration (or whatever you use) tu use
https as a base url of your site.