Lets Learn:
- ๐ง What GitHub Pages is
- ๐ ๏ธ How to host a self-made HTML page
- ๐ Creating a simple
index.html
(homepage) - โญ Adding a custom favicon
- ๐ Going live with GitHub Pages
Want to create your own personal website or project page without paying for hosting?
GitHub Pages lets you host static websites (HTML/CSS/JS) for free โ and itโs easier than you think.
In this post, youโll learn how to:
โ
Set up GitHub Pages
โ
Create your first index.html
homepage
โ
Add a custom favicon
โ
Publish your site at https://yourusername.github.io/
Letโs go!
๐ Step 1: Create a GitHub Repository
- Go to https://github.com/new
- Set your repository name as:
yourusername.github.io
๐ Replace yourusername
with your actual GitHub username (must match exactly).
- Choose Public
- Leave everything else blank (donโt add README, .gitignore, etc.)
- Click Create repository
๐ Step 2: Add Your First Web Page (index.html)
You can do this by uploading files directly via GitHubโs interface:
- Click โAdd fileโ โ โUpload filesโ
- Create a new file called
index.html
- Paste the following code:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>Welcome!</title> <link rel="icon" href="favicon.ico" /> </head> <body> <h1>Hello, world!</h1> <p>This is my first self-hosted page using GitHub Pages.</p> </body> </html>
- Scroll down and click โCommit changesโ
๐ Step 3: Add a Favicon (optional but cool)
A favicon is the small icon you see in browser tabs.
- Create or download a
favicon.ico
(you can use favicon.io) - Upload it to the same repository
- Make sure this line is in your
<head>
:
<link rel="icon" href="favicon.ico" />
Done! Your site now has a personal touch.
๐ Step 4: Go Live with GitHub Pages
Now the magic part.
- Go to the Settings tab of your repository
- Scroll down to "Pages" in the sidebar (or search for it)
- Under "Deploy from a branch", choose:
- Source:
main
ormaster
- Folder:
/ (root)
- Click Save
Within 30โ60 seconds, your website will be live at:
https://yourusername.github.io/
๐ Congrats, youโre live!
๐ง Tips
- Your homepage should always be named
index.html
- You can create more pages (e.g.
about.html
,projects.html
) and link them - For a more professional look, add CSS styles or use a static site generator (like Jekyll or Hugo)
๐ฌ Final Thoughts
GitHub Pages is perfect for:
- Personal portfolios
- Documentation sites
- Project demos
- Student assignments
- Web experiments
And the best part? Itโs free and super lightweight.
Have you published your own page yet? Drop a link in the comments โ Iโd love to see it! ๐
๐ Follow me for more web dev tips, GitHub tricks, and DIY web projects!
Top comments (0)