Metadata
- Date :: 13-04-2025
- Tags :: web-dev
Notes
๐ Bonus Lesson: Hosting Your HTML Portfolio Website Online with GitHub Pages
๐ Lesson Objective
In this bonus lesson, youโll learn:
-
What web hosting is and how it works.
-
Why hosting is essential for real-world web development.
-
How to host your HTML portfolio project online using GitHub Pages, a free and reliable hosting solution.
-
How to make your site accessible to anyone in the world through a live URL.
By the end, your portfolio website will be live on the internet, ready to be shared with friends, family, employers, and fellow developers.
๐ What is Web Hosting?
๐ Definition:
Web Hosting is the process of putting your website (HTML, images, files, etc.) on a web server thatโs connected to the Internet, making it accessible 24/7 from anywhere in the world.
๐ Why Web Hosting Matters:
-
Without hosting, only you can see your site (on your local computer).
-
Hosting allows everyone else (like someone in the U.S., India, or Brazil) to access your site via a URL (web address).
-
Itโs crucial if you want to:
-
Share your work with others
-
Build a professional presence
-
Apply for web dev jobs or freelance gigs
-
๐ฅ๏ธ Local vs. Hosted Websites
| Type | Description |
|---|---|
| Local | Files are stored on your own computer. Only you can open them using your browser. |
| Hosted | Files are stored on a web server. Anyone with the URL can visit your site online. |
When you build projects on your own device, itโs local development. Web hosting turns it into a live website.
๐ฆ What is a Web Server?
A web server is just a special computer thatโs always connected to the Internet. It:
-
Stores your site files (like
index.html, images, etc.) -
Waits for users to request those files
-
Sends the correct web pages to usersโ browsers
GitHub Pages gives us access to such servers for free.
๐ ๏ธ Steps to Host Your Portfolio with GitHub Pages
Letโs now walk through the step-by-step guide to publish your portfolio online using GitHub.
โ Step 1: Create a GitHub Account
-
Go to https://github.com
-
Click Sign up if you donโt already have an account.
-
If you do, just Sign in.
โ Step 2: Create a New Repository
-
Click the โ icon (top-right of GitHub UI).
-
Select New repository.
-
Fill in the details:
-
Repository name:
html-portfolio -
Description: (optional) e.g., โMy first portfolio website built with HTMLโ
-
Choose Public
-
โ Check the box that says Add a README file
-
-
Click Create repository
๐ The README file helps initialize your repository and allows file uploads through the browser UI.
โ Step 3: Upload Your Project Files
-
Inside your new repo, click the Add file button โ select Upload files.
-
Navigate to your HTML portfolio folder (on your computer).
-
Important: Only upload the contents of the folder, not the folder itself. For example, upload:
-
index.html -
about.html -
contact.html -
assets/(with images) -
public/(with birthday-invite.html, movie-ranking.html)
-
โ Tip: Before uploading, double-check that:
-
Your main home page is named
index.html. -
All project files are complete and up to date.
-
All screenshots are placed inside
assets/images/.
- After selecting files, click Commit changes at the bottom.
โ Step 4: Configure GitHub Pages Hosting
-
Once files are uploaded, go to the Settings tab of your repo.
-
Scroll down to the Pages section in the sidebar.
-
Under Source, select:
-
Branch:
main -
Folder:
/ (root)
-
-
Click Save
GitHub will begin publishing your site in the background.
๐ Wait for Deployment
-
It may take 1 to 10 minutes for GitHub to deploy your site.
-
Refresh the Pages section periodically.
-
Eventually, youโll see a message like:
โ Your site is live at
https://your-username.github.io/html-portfolio/
Click the link to open your live website!
โ ๏ธ Common Issues to Avoid
| โ Problem | โ Solution |
|---|---|
| Uploaded the wrong folder | Only upload the contents, not the parent folder |
| Homepage not loading | Ensure your main file is named index.html, all lowercase |
| Project not rendering properly | Double-check image paths and relative links |
| โNo server availableโ error | Refresh the page after waiting a few minutes |
| Files missing | Re-upload and ensure commit changes was clicked |
๐งช Test Your Website
-
Open the link provided by GitHub Pages.
-
Click each project link to test navigation.
-
Make sure images load and all links work.
-
Visit from your phone or another device to confirm itโs accessible publicly.
๐ Share Your Website
Now that your site is live, copy the link and:
-
Share it with your friends and family
-
Post in your course Q&A or discussion forums
-
Add it to your resume or LinkedIn profile
-
Impress future clients or employers!
Example:
https://janedoe.github.io/html-portfolio/
๐งโ๐จ Whatโs Next?
Now that your HTML-only site is live, itโs time to:
-
Learn CSS to make your site look amazing
-
Add styles, colors, fonts, and layout control
-
Build modern, professional-looking websites
๐ก Styling is covered in the next section of your course, where youโll learn how to transform your plain HTML into stunning web pages.
๐ฏ Summary
| Step | Action |
|---|---|
| 1 | Sign in to GitHub |
| 2 | Create a public repo named html-portfolio |
| 3 | Upload your HTML files, images, and folders |
| 4 | Commit the changes |
| 5 | Go to Settings โ Pages |
| 6 | Set source to main branch |
| 7 | Wait for deployment, then visit your live site |
๐ Bonus: What is GitHub Pages?
GitHub Pages is a free service provided by GitHub that lets you host static websites directly from your GitHub repository. It:
-
Supports only HTML, CSS, JS (no backend)
-
Is perfect for portfolios, documentation, and simple projects
-
Has a free subdomain like
yourusername.github.io