Put your page online
You'll learn to put your profile page online with GitHub Pages, for free, with a link anyone can open.
Watch & read
Start with the required ones. The others are there when you need them.
Explanation
Your profile page works on your laptop. But the address starts with file://, so only you can see it.
You want a real https:// link you can send to anyone.
For that, your files must sit on a server that is always on. Renting one is called hosting. GitHub Pages is free hosting for plain HTML, CSS and JavaScript, and you already have a GitHub account.
Think of it like a shop window. Your files live in a GitHub repository, like goods in a storeroom. GitHub Pages puts them in the window, at an address everyone can visit.
The steps:
- Create a new public repository named exactly
username.github.io, with your GitHub username. - Upload your files, or
git pushthem. The main page must be calledindex.html. - Wait a minute or two, then open
https://username.github.io.
username.github.io/index.htmlstyle.cssphoto.jpg
When someone opens your address, GitHub's server answers with index.html, just like in the first topic
of this phase. Then the browser asks for style.css and photo.jpg the same way.
People often name the main file Index.html or home.html. Then the address shows a 404, because the
server looks for index.html exactly. The other common one: the CSS loads on your laptop but not online.
Windows and macOS do not care about capital letters, but the server does. Photo.jpg is not
photo.jpg. Open DevTools, check the Network tab, and fix the name.
When you read a project folder, find index.html first. Then follow each href and src in it, and
check that every file it names really exists, with the same spelling.
Code tour
Click a line number with a ring to read the note for that line.
Quick check
3 questions. Each one explains itself after you answer.
- 1 / 3Your GitHub username is
nusrat-dev. What should the repository be called? - 2 / 3Your main file is called
home.html. What happens athttps://nusrat-dev.github.io? - 3 / 3Your HTML says
src="Photo.JPG", and the file isphoto.jpg. It works on your laptop. Online?
Explain it back
How confident are you with Put your page online?
Done
username.github.io and fix it when a file does not load.