Home Blog How to Set Up a Custom Domain for Your Jekyll Site
Tutorial

How to Set Up a Custom Domain for Your Jekyll Site

Connect a custom domain to your Jekyll site on GitHub Pages, Netlify, or Cloudflare Pages — with DNS setup, HTTPS configuration, and www vs apex domain guidance.

How to Set Up a Custom Domain for Your Jekyll Site

Getting your Jekyll site onto a custom domain takes about 10–30 minutes. The process is the same regardless of which registrar you use — you update DNS records and tell your hosting platform about the domain. This guide covers GitHub Pages, Netlify, and Cloudflare Pages.


Before You Start

You need:

  • A domain name (from Namecheap, GoDaddy, Google Domains, Porkbun, or any registrar)
  • Your Jekyll site already deployed to GitHub Pages, Netlify, or Cloudflare Pages

DNS changes take anywhere from a few minutes to 48 hours to propagate globally. Most changes take effect within 30 minutes.


Apex Domain vs www

You have two common choices:

  • Apex domain: yourdomain.com — cleaner, but some DNS providers don’t support ALIAS/ANAME records for it
  • www subdomain: www.yourdomain.com — a standard CNAME works, very reliable
  • Both: redirect www to apex, or apex to www — best user experience

Most modern hosting platforms support apex domains directly. Our recommendation: use the apex domain (yourdomain.com) as primary and redirect www to it.


Option 1: GitHub Pages + Custom Domain

Step 1: Add the CNAME File

In your Jekyll site’s root directory, create a file named CNAME (no extension) containing only your domain:

yourdomain.com

Commit and push this file. GitHub Pages reads it and serves the site at that domain.

Important: If you use GitHub Actions for deployment, include the CNAME file in your _site output or add it to the build step. Otherwise it may get overwritten on each deploy.

Step 2: Configure DNS

In your domain registrar’s DNS settings, add these records:

For an apex domain (yourdomain.com):

Add four A records pointing to GitHub Pages’ IP addresses:

Type Name Value
A @ 185.199.108.153
A @ 185.199.109.153
A @ 185.199.110.153
A @ 185.199.111.153

For www subdomain:

Type Name Value
CNAME www yourusername.github.io

Step 3: Enable in GitHub Repository Settings

  1. Go to your repository → Settings → Pages
  2. Under Custom domain, enter yourdomain.com
  3. Click Save
  4. Check Enforce HTTPS (available after DNS propagates)

Step 4: Verify

GitHub will show a green checkmark once DNS is propagating correctly. Visit https://yourdomain.com — it should load your Jekyll site with a valid SSL certificate.


Option 2: Netlify + Custom Domain

Step 1: Add Domain in Netlify

  1. In Netlify Dashboard, go to your site → Domain management → Add a domain
  2. Enter your domain and click Verify
  3. Click Add domain

Step 2: Configure DNS

Option A: Use Netlify DNS (Recommended)

Transfer your domain’s nameservers to Netlify’s. In Netlify, click Set up Netlify DNS and follow the instructions. You’ll get four nameservers like:

dns1.p01.nsone.net
dns2.p01.nsone.net
dns3.p01.nsone.net
dns4.p01.nsone.net

Update your registrar’s nameserver settings to these four. This gives Netlify full DNS control and enables automatic HTTPS and www→apex redirect.

Option B: Keep Your Existing DNS

Add these records in your registrar:

Type Name Value
A @ 75.2.60.5
CNAME www yoursitename.netlify.app

Step 3: HTTPS

Netlify provisions a free Let’s Encrypt certificate automatically within minutes of DNS propagating. You don’t need to do anything — it just works.


Option 3: Cloudflare Pages + Custom Domain

If your site is on Cloudflare Pages and your domain is on Cloudflare (or you move it there):

Step 1: Add Custom Domain

  1. In Cloudflare Dashboard → Pages → your project → Custom domains
  2. Click Set up a custom domain
  3. Enter your domain and click Continue

Step 2: DNS (if domain is on Cloudflare)

Cloudflare automatically adds the DNS record. Done.

Step 3: DNS (if domain is on another registrar)

Add a CNAME record:

Type Name Value
CNAME @ (or yourdomain.com) yourproject.pages.dev
CNAME www yourproject.pages.dev

Note: Some registrars don’t support CNAME on the apex (@). Use an ALIAS or ANAME record instead if available, or switch to Cloudflare DNS (it’s free and excellent).

HTTPS

Cloudflare provides HTTPS automatically via their edge network. No certificate configuration needed.


Redirecting www to Apex (or Vice Versa)

Users will type both www.yourdomain.com and yourdomain.com. Pick one as canonical and redirect the other.

On Netlify — automatic if you use Netlify DNS. Otherwise add to _redirects:

https://www.yourdomain.com/* https://yourdomain.com/:splat 301!

On Cloudflare — add a Page Rule or Redirect Rule: www.yourdomain.com/*https://yourdomain.com/$1 (301)

On GitHub Pages — add both yourdomain.com and www.yourdomain.com to your CNAME, GitHub handles the redirect automatically.


Update _config.yml

Once your custom domain is live, update your Jekyll config:

# _config.yml
url: "https://yourdomain.com"
baseurl: ""   # Empty for root domain

This ensures all canonical URLs, sitemaps, and Open Graph tags use your custom domain.

Rebuild and redeploy after this change.


Verify Everything Is Working

Check HTTPS:

curl -I https://yourdomain.com
# Should return: HTTP/2 200

Check www redirect:

curl -I https://www.yourdomain.com
# Should return: HTTP/2 301 and Location: https://yourdomain.com/

Check SSL certificate:
Open your site in a browser and click the padlock icon. The certificate should show as valid and issued for your domain.

Check Google Search Console:
Add your domain as a property in Search Console and verify ownership. Submit your sitemap at https://yourdomain.com/sitemap.xml.


Common Issues

Site still showing at username.github.io after setting custom domain
Wait for DNS propagation (up to 48 hours). Check propagation status at dnschecker.org.

HTTPS not working / certificate error
The SSL certificate is provisioned after DNS propagates. Wait 30–60 minutes after DNS is confirmed working.

www not redirecting
You need separate DNS records for www. Add the CNAME for www pointing to your hosting platform.

Jekyll site assets (CSS/JS) not loading after domain change
Update url in _config.yml to your new domain and ensure baseurl is empty. Rebuild and redeploy.


Once your custom domain is set up, your Jekyll site at yourdomain.com is fully production-ready. Browse Jekyll themes on JekyllHub to find a design that represents your brand.

Email with your custom domain

A custom domain is not just for your website — it is the foundation of a professional email address. Receiving emails at hello@yourdomain.com or satish@yourdomain.com rather than a Gmail or Outlook address signals professionalism and makes your communications more memorable.

The most accessible option for small sites is Cloudflare Email Routing (free), which forwards emails sent to your domain to your existing Gmail or Outlook account. You receive mail at yourname@yourdomain.com but it arrives in your existing inbox — no separate email client or account to manage. Sending replies from the custom address requires a Gmail or Outlook setting to send from an alias, which is a five-minute configuration.

For more complete email functionality — a proper mailbox at your domain, a separate inbox, mobile email app support — Fastmail ($3/month for a single user) or Zoho Mail (free for up to five users) are well-regarded options. Both provide professional email at a custom domain without the enterprise pricing of Google Workspace or Microsoft 365. For a professional blogger or freelancer, either option is sufficient and significantly cheaper than the enterprise alternatives.

Domain renewal and long-term management

Registering a domain is easy; maintaining it over years requires attention to renewal dates, contact information accuracy, and registrar health. A domain that lapses — not renewed before its expiration date — can be registered by a domain squatter within days of expiration, and recovering it is expensive if possible at all.

Enable auto-renewal for your domain at the moment of registration. Set a reminder to check that the payment method on file with your registrar is current three months before renewal — expired credit cards are the most common reason auto-renewal fails. Keep your registrar account’s email address current: domain renewal notices go to the registrant email address, and a stale email address means you never see the warnings.

Register your domain for multiple years at a time where your registrar allows it. Most registrars allow registration for up to ten years. A ten-year registration reduces the administrative overhead of renewal and, for important business domains, provides a degree of insurance against accidentally forgetting to renew. The cost is the same as annual renewal — just prepaid — with the benefit of not needing to manage the renewal process for a decade.

When to use a subdomain vs subdirectory

Some site architectures involve multiple content sections that could be organised as either subdomains (blog.yourdomain.com) or subdirectory paths (yourdomain.com/blog/). This choice has SEO implications that are worth understanding before committing to a structure.

Google treats subdomains and subdirectories differently in terms of domain authority. Content at blog.yourdomain.com builds authority for the subdomain, while content at yourdomain.com/blog/ builds authority for the root domain. For sites where growing the main domain’s authority is important, the subdirectory structure consolidates all link equity at the root. For sites where the blog and main site are genuinely separate audiences or products, a subdomain is appropriate.

For most Jekyll sites — where the blog is part of a unified site presence rather than a separate product — the subdirectory structure (yourdomain.com/blog/) is the better SEO choice. GitHub Pages supports subdirectory paths naturally; a subdomain requires a separate repository or build target.

Protecting your domain with registrar lock

Domain hijacking — where an attacker gains control of your domain by transferring it to another registrar — is a real risk, particularly for established domains with existing search rankings and backlinks. Registrar lock (also called transfer lock or domain lock) prevents unauthorised transfers by requiring explicit confirmation from the domain owner before a transfer can proceed.

Enable registrar lock immediately after registration. It takes effect immediately and can be removed temporarily when you legitimately want to transfer the domain to a different registrar. Most premium registrars (Cloudflare Registrar, Namecheap) enable lock by default; verify it is active in your domain management dashboard.

Enable two-factor authentication on your registrar account if you have not already — this is the most important security measure for protecting your domain. A hijacked registrar account bypasses all domain lock protections because the attacker can simply unlock the domain through your compromised account. Authenticator app-based 2FA (rather than SMS) is recommended for registrar accounts because SIM-swap attacks targeting SMS-based 2FA have been used to hijack high-value domains.

The professional value of a custom domain

A custom domain is one of the highest-leverage investments available for a personal or professional site. The annual cost — $10-15 for a common TLD — is less than a monthly coffee subscription. The professional signal it sends is immediate and permanent: a site at yourname.com reads as intentional and professional in a way that yourname.github.io does not.

For freelancers, consultants, and job seekers, a custom domain with your name is the single most effective professional branding investment available at this price point. It ensures that when anyone searches for your name, the first result is a page you control, presenting you in the way you choose to be seen. That control over your professional narrative is worth far more than the domain’s annual renewal cost.

Share LinkedIn