Project notes · 15 dic

How I Built a Website Using GitHub Pages and a Custom Domain

How I Built a Website Using GitHub Pages and a Custom Domain

Introduction

A while ago, I needed to create a simple but professional website. I wanted something reliable, easy to update, and — most importantly — free. After a bit of research, I discovered GitHub Pages, a service that lets you host static websites directly from a GitHub repository. In this post, I'll walk you through how I built the website chirurgiacaviglia.it using GitHub Pages and connected it to a custom domain.

Index

  1. Why Use GitHub Pages?

  2. Setting Up a GitHub Repository

  3. Building the Website

  4. Publishing with GitHub Pages

  5. Connecting a Custom Domain

  6. Lessons Learned

  7. Conclusion

1. Why Use GitHub Pages?

GitHub Pages offers a lot of advantages, especially for small personal or project websites:

For a lightweight website that doesn't need server-side scripting, GitHub Pages is perfect.

2. Setting Up a GitHub Repository

The first step was creating a new repository on GitHub.

3. Building the Website

I kept it simple:

The file structure looked like this:

/
|- index.html
|- style.css
|- /images
|- /about.html

I used basic HTML and CSS to create a clean and professional layout. No frameworks or fancy JavaScript for this project — just straightforward static content.

4. Publishing with GitHub Pages

Publishing the site was super easy:

After a few minutes, GitHub built the site and gave me a live link: https://<username>.github.io/<repository>/.

5. Connecting a Custom Domain

I wanted the website to be accessible through my own domain, chirurgiacaviglia.it. Here's what I did:

Step 1: Create a CNAME File

chirurgiacaviglia.it

Step 2: Set Up DNS Records

Step 3: Wait for DNS Propagation

Step 4: Enable HTTPS

6. Lessons Learned

7. Conclusion

Building and publishing a professional website using GitHub Pages was much easier than I expected. The whole process cost me almost nothing (just the domain registration), and now I have full control over updates through Git.

If you're looking for a simple, reliable way to put a project or portfolio online, GitHub Pages is a fantastic option. I highly recommend giving it a try!

← All articles