T1 HTML · Lesson 8
Putting a page online
What hosting is and how an address becomes a file; a head ready for search results and shared links; checking a page with the W3C validator; a first page online for free with GitHub Pages; and what a domain name and HTTPS add.
- say what hosting is, how a host turns an address into a file, and why index.html is special
- finish a page's head with a description, an icon and the tags that shape a shared link
- check a page with the W3C validator and fix what it finds
- put a page online for free, step by step, and update it
- say what a domain name and HTTPS add, and what they cost
The back cover
A page on your laptop is like a home kitchen: the food is good, but only the family eats it. To feed the town, you open a stall on a busy street, open at all hours, with an address people can find. Putting a page online is opening that stall.
These pages show how a host turns an address into a file. A few lines in the head then shape a search result, a browser tab and a shared link. They check a page with the W3C validator and put a first page online for free. Last comes a name of its own, sealed with HTTPS.
Before you start
The story: Raise it on a tower
Your panels have only ever shone in the shop. Master Tobin looks at your notice for the Lamplighters' Fair and taps it. "A panel nobody can see is a drawing," he says. "It is time to raise it on a public tower."
There is a lot to get right. The tower keepers want to know which file is the front of your panel. The city's proofreader must pass it. The tower's name must point to your panel. And the padlock, the seal that keeps every courier's envelope closed, must be on it.
Corin raised his last week. It shows the fish market again.
Seven lessons have built pages that live on your laptop. This last lesson of the HTML step puts one on the web, at an address anyone can open, for free. It also finishes the head of a page, so that it looks right in a search result and in a shared link. It builds on these ideas; each has a tiny example.
| What you already know | A tiny example | Where it comes back |
|---|---|---|
| A server answers requests. | GET /offers.html, and the reply 200 OK with the page. | Hosting is renting a server that answers for your files. |
| DNS turns a name into a number. | study.rohannetworks.com to the address of a computer. | Your own domain name points at your host the same way. |
| HTTPS seals what travels. | The padlock in the address bar. | Free hosts give every site HTTPS. |
| A website is a folder of files. | index.html, about.html, images/logo.svg. | That folder is exactly what you upload. |
| Relative paths. | ../about.html goes up one folder. | They must work on the host as they did on the laptop. |
| The head holds information about the page. | <title> and <meta charset>. | It gains a description, an icon and tags for shared links. |
| The viewport tag. | <meta name="viewport" content="width=device-width, initial-scale=1"> | Every page you put online needs it. |
| The browser repairs broken HTML silently. | An unclosed em runs on into the next paragraph. | A validator finds what the browser hides. |
| Capitals in file names matter online. | Logo.svg and logo.svg are two files on a server. | The most common reason a page works on a laptop and not online. |
By the end of this lesson you will be able to:
- say what hosting is, how a host turns an address into a file, and why index.html is special;
- finish a page's head with a description, an icon and the tags that shape a shared link;
- check a page with the W3C validator and fix what it finds;
- put a page online for free, step by step, and update it;
- say what a domain name and HTTPS add, and what they cost.
In one line
Putting a page online means copying its folder to a host that answers requests for it; you need lesson 1's requests, DNS and HTTPS, and lesson 3's paths.
Hosting: a server for your folder
At a glance
A page on your laptop is a home kitchen; hosting is the stall on a busy street. A host is a company, or a computer, that keeps a site's files on a server, always on and always connected, and sends them to every browser that asks.
The host reads the path of each address as a path in your folder. An address that names a folder gets that folder's index.html, so the home page is always index.html, and a link to a folder ends with a slash. File names in small letters, matching every link, avoid a common surprise.
Take a guess: When an address names only a folder, which file should the host send back?
A home kitchen can cook a fine meal, but only the family eats it. To feed the town, you open a stall on a busy street, open at all hours, with an address people can find. A page on your laptop is the home kitchen. Hosting is the stall: a computer that is always on, always connected, and answers anyone who asks for your page.
A company, or a computer, that keeps your site's files on a server and sends them to every browser that asks. A site made only of files that are sent as they are, HTML, CSS, pictures, is a static site, and many hosts serve static sites for free.
Every page in this HTML step is a static site. The server does no work but find the file and send it. Sites that build each page fresh, such as a bank's account page, need a program on the server; the Node.js step builds those.
How an address becomes a file
You upload your site's folder to the host. From then on, the path of each address is read as a path inside that folder, exactly like the paths of lesson 3.
The folder you upload
shop/
index.html the home page
about.html
offers/
index.html the offers page
deals.html
images/
logo.svg
| Address | The host sends | Why |
|---|---|---|
https://shop.example.com/about.html | about.html | the path names the file |
https://shop.example.com/offers/deals.html | offers/deals.html | a folder, then a file inside it |
https://shop.example.com/ | index.html | a path ending in a folder gets that folder's index.html |
https://shop.example.com/offers/ | offers/index.html | the same rule, one folder down |
That last rule is why the home page is always called index.html: when an address names only a folder, the host sends the file called index.html inside it. Name your home page home.html, and the bare address of your site gives a 404.
The slash at the end matters
Many hosts send offers/index.html for both /offers and /offers/. But the browser works out relative paths from the address it shows, and the two addresses are not the same to it. One ends in a folder; the other looks like a file called offers.
<!-- a link written inside offers/index.html -->
<a href="deals.html">Today's deals</a>
Checked in Chrome
- opened as /offers/, the link reaches /offers/deals.html
- opened as /offers, the same link reaches /deals.html, which does not exist
The checks work the path out from each address, as the browser does. With the slash, deals.html sits in the offers folder. Without it, the browser thinks offers is a file at the top, so deals.html is looked for at the top too, and the visitor gets a 404. Link to folders with the slash at the end, href="/offers/", and the problem never arises.
Two rules for a site that works online
The home page is index.html, and a link to a folder ends with a slash. Together with lesson 3's rule, small letters in every file name, they prevent most "works on my laptop" faults.
Worked example 1
A student's site has the files home.html, Gallery.html and photos/Trip.JPG. On the laptop everything opens. Online, the bare address shows a 404, and the gallery's photo is missing. Find the faults and the fixes.
What we have: three file names and two symptoms
What we need: the cause of each symptom and a fix
The plan: check the name of the home page, then the capitals in every name
- The bare address asks for the folder, so the host sends index.html. There is none: the home page is called home.html. Fix: rename it index.html.
- The photo: the page probably asks for photos/trip.jpg, but the file is Trip.JPG. A laptop often treats the two as the same; a server does not. Fix: rename the file trip.jpg and write paths in small letters.
- Gallery.html works only if every link writes it with the same capital G. Safer: rename it gallery.html and update the links.
Rename home.html to index.html, and every file to small letters, matching every link.
Check: after the renames, every address the browser asks for matches a file exactly, letter by letter.
A path that fails: Fixing the photo by changing the link to Trip.JPG. It works today, but the next photo will break the same way; one rule for all names, small letters, ends the problem.
When you are stuck: hosting
Picture the host reading the address's path as a path in your folder. Which file does it land on?
A 404 for the bare address: is there an index.html at the top of the folder?
A broken relative link on a folder page: does the address end with a slash?
Your turn
What does a host send for https://shop.example.com/ ?Tap to reveal
- The address names only the top folder.
That folder's index.html.
What is a static site?Tap to reveal
- Think of what the server has to do.
A site of files sent as they are, with no program building pages on the server.
Inside offers/index.html, a link says href="deals.html". Which file does it reach when the page is opened as /offers/ ?Tap to reveal
- The address ends in a folder.
/offers/deals.html.
Did you know?
The first web server
The world's first web server was a NeXT computer that Tim Berners-Lee used at CERN. Its software, CERN httpd, was developed at CERN from 1990 onwards by Berners-Lee, Ari Luotonen and Henrik Frystyk Nielsen, and it was the first web server software. The first website still has a home at info.cern.ch.
Why it fits here: Every host in this topic does the job that one NeXT computer did first: keep the files and answer every browser that asks.
Sources: Wikipedia: CERN httpd; CERN: info.cern.ch, home of the first website
The slash a server adds
Apache, a web server first released in April 1995, still answers folders this way. Asked for a folder's address without its slash, it redirects the browser to the same address with the slash, because directories require a trailing slash. Asked for a folder, its default is to look for a file named index.html.
Why it fits here: The slash at the end of a folder's address, and the index.html it finds, are the two rules of this topic.
Sources: Apache HTTP Server documentation: mod_dir; Wikipedia: Apache HTTP Server
In one line
A host keeps your folder on a server and reads each address's path as a path in it. A folder's address gets its index.html, so the home page is index.html, and links to folders end with a slash.
Finishing the head
At a glance
A shop's signboard, its visiting card and the sticker on its bags all show the shop before anyone steps inside. A page has the same: a few lines in its head decide how it looks in a search result, in a browser tab, and in a link shared on WhatsApp.
A meta description offers the short text under a search result. A favicon is the small picture in the tab. Open Graph tags, such as og:title, og:description and og:image, shape the card that appears when the link is shared, and og:image needs a full address.
Take a guess: When you share a link on WhatsApp, where does the picture in its card come from?
A shop's signboard, its visiting card and the sticker on its delivery bags all show the shop before anyone steps inside. A page has the same. A few lines in its head decide how it looks in a search result, in a browser tab, and in a link shared on WhatsApp, before anyone opens it.
A head ready for the web
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Asha Stores | Fresh vegetables in Kothrud, Pune</title>
<meta name="description" content="Fresh vegetables and groceries every morning, delivered free in Kothrud above ₹499.">
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><circle cx='8' cy='8' r='7' fill='orange'/></svg>">
<meta property="og:title" content="Asha Stores, Kothrud">
<meta property="og:description" content="Fresh vegetables every morning, delivered free above ₹499.">
<meta property="og:image" content="https://ashastores.example/images/share.jpg">
<meta property="og:url" content="https://ashastores.example/">
</head>
<body>
<h1>Asha Stores</h1>
</body>
</html>
Checked in Chrome
- the title names the page and the shop
- a description for search results
- an icon for the tab
- a title for shared links
- and a picture for them, with a full address
Here is each new line, and what it does.
| Line | What it does | Where people see it |
|---|---|---|
<meta name="viewport" ...> | lays the page out at the phone's own width (lesson 7) | every phone |
<title> | names the page; give each page its own | the tab, bookmarks, the blue line of a search result |
<meta name="description" content="..."> | a sentence or two about the page | often the grey text under the title in a search result |
<link rel="icon" href="..."> | the small picture for the page, called a favicon | the tab, bookmarks, a phone's history |
<meta property="og:title" ...> and the other og: lines | Open Graph tags: the title, words and picture of a shared link | the preview card in WhatsApp, Telegram, LinkedIn and others |
The description
Search engines often show the description under your title. Write it for a person deciding whether to click: what the page offers, in about 150 characters or fewer, since longer ones are cut off. Give every page its own.
The favicon
The <link rel="icon"> line points at the picture for the tab. It is usually a small file, such as /favicon.svg or /favicon.ico, at the top of the site's folder. Here it is a tiny drawing written into the address, as in lesson 3, so the example needs no file. If you give no icon, browsers ask the server for /favicon.ico anyway, and log a 404 when there is none.
Open Graph: how a shared link looks
Paste a link into WhatsApp and a card appears: a picture, a title, a line of text. The app reads these from the page's Open Graph tags. Each is a meta element with a property such as og:title and a content.
- og:title: the card's title, which can be shorter than the page's title;
- og:description: one line under it;
- og:image: the card's picture. It must be a full address starting with https://, because the app fetches it from its own servers, not from your page;
- og:url: the page's own full address.
Without these tags, apps guess, and often show a bare link with no picture. With them, your shared page looks like a proper card.
Worked example 2
A coaching class's results page is shared in a parents' WhatsApp group, but it shows only a bare link, and its search result says "Untitled". Which lines are missing from the head, and what should they say?
What we have: a page with no title, no description and no Open Graph tags
What we need: the head lines that fix the search result and the shared card
The plan: the search result needs a title and a description; the card needs og:title, og:description and og:image
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Class 10 results 2027 | Bright Minds Classes, Nagpur</title>
<meta name="description" content="Our Class 10 board results for 2027: toppers, subject averages and next year's batches.">
<meta property="og:title" content="Class 10 results 2027">
<meta property="og:description" content="Toppers, subject averages and next year's batches.">
<meta property="og:image" content="https://brightminds.example/images/results-2027.jpg">
</head>
<body>
<h1>Class 10 results 2027</h1>
</body>
</html>
Checked in Chrome
- the search result now has a real title
- a description short enough not to be cut off
- the three tags the card needs
A title, a meta description, and og:title, og:description and og:image.
Check: the second check counts the description's characters, so it fits under the title without being cut.
Worked example 3
A tiffin service's page has the description: Welcome to our website. We are a food business. We provide services. Please visit us and contact us for more information about everything we offer to our customers. Rewrite it so it helps someone deciding whether to click.
What we have: a long description that says nothing particular
What we need: a short description that says what the page offers
The plan: say who, what and where in one or two short sentences, and keep it near 150 characters or fewer
- The old one is about 30 words and names nothing: no food, no place, no price. A reader learns nothing from it.
- What would make someone click? What the tiffins are, where they deliver, and what they cost.
<meta name="description" content="Home-style veg tiffins in Baner and Aundh, Pune: lunch and dinner from ₹90 a meal. Order by 10 am for lunch.">
Checked in Chrome
- the new description fits, at 150 characters or fewer
- and it names the place, the price and the meal
Home-style veg tiffins in Baner and Aundh, Pune: lunch and dinner from ₹90 a meal. Order by 10 am for lunch.
Check: the check counts its characters in the browser, and every word in it is something a hungry reader wants to know.
When you are stuck: the head
Ask where the page will be seen before it is opened: a tab, a search result, a shared card. Each has its own line in the head.
Every page gets its own title and description.
og:image always takes a full https:// address.
Your turn
Which line gives a page its picture in the browser tab?Tap to reveal
- It is a link element with rel="icon".
<link rel="icon" href="...">, the favicon.
Where do apps such as WhatsApp find a shared link's title and picture?Tap to reveal
- The tags start with og:.
In the page's Open Graph meta tags.
Why must og:image be a full https:// address?Tap to reveal
- Who fetches the picture?
Because the app fetches it from its own servers, so a path relative to your page means nothing to it.
Did you know?
The snippet is Google's choice
Google says it builds the short text under a search result, the snippet, mainly from the page's own content, and may show different snippets for different searches. It may use the meta description when that describes the page better. Another old tag counts for nothing at Google: on 21 September 2009 it wrote that it does not use the keywords meta tag in web search ranking.
Why it fits here: The meta description of this topic is an offer to the search engine, not an order, so it is written for the person deciding whether to click.
Sources: Google Search Central: Control your snippets in search results; Google Search Central Blog: Google does not use the keywords meta tag in web ranking
Favicon means favorite icon
The word favicon is short for favorite icon. Favicons began in March 1999, when Microsoft released Internet Explorer 5, which supported them for the first time. The icon was a file called favicon.ico in the top folder of a site, shown in the browser's favorites. A side effect: counting requests for that file gave an estimate of how many visitors had bookmarked the page.
Why it fits here: The favicon line of this topic is the modern way to name that picture, and the HTML standard still lets browsers ask for /favicon.ico when a page names none.
Sources: Wikipedia: Favicon; HTML Standard (WHATWG): link type icon
In one line
A finished head has the charset, the viewport, a title and a meta description for search results, and a favicon for the tab. Open Graph tags (og:title, og:description, og:image with a full address) shape shared links.
Checking a page before it goes online
At a glance
A printing press prints exactly what you give it, mistakes and all, so a newspaper has a proofreader. HTML needs one too, because the browser never complains: it repairs mistakes silently and shows its best guess, so the page on screen can look perfect while its source is broken.
A validator reads your HTML exactly as written and lists everything that breaks the rules, with the line of each problem. The W3C's is free at validator.w3.org. Fix the first error, check again, and repeat until the list is empty; DevTools' Issues tab is a quick second check.
Take a guess: If a page looks perfect on screen, can its HTML still be broken?
A printing press does not correct your spelling: it prints what you give it. A newspaper therefore has a proofreader, who reads every page before it goes to print. HTML needs a proofreader too, because the browser, as you saw in every lesson, never complains. It repairs mistakes silently and shows its best guess, and the guess can differ from one browser to another.
A program that reads your HTML exactly as written and lists everything that breaks the rules of HTML, with the line where each problem is. The standard one is the W3C Markup Validation Service, at validator.w3.org, free for anyone.
Using it
- Open validator.w3.org in a browser.
- Choose how to give it the page: its address (for a page already online), a file from your laptop, or the HTML pasted in.
- Press Check.
- Read the list. Each item says Error or Warning, the line and column, and what is wrong. Fix the first error first: one slip, such as an element never closed, often causes several errors after it, which then vanish.
Why the browser cannot be your checker
The page you see in the browser is the repaired page. A closing tag with no opening tag, such as a stray </div>, is dropped by the browser while it reads the page, so it is gone before any script could notice it. The validator reads the source itself, so it sees what the browser threw away.
<p>Fresh today</p>
</div>
<p>Open till 9</p>
Checked in Chrome
- the stray </div> left no trace in the page the browser built
- both paragraphs show, so on screen nothing looks wrong
On the screen, this page looks perfect, and the browser built no div at all. Only a validator, reading the source, would report the closing tag that matches nothing.
What a validator finds
| Kind of problem | An example | Taught in |
|---|---|---|
| an element never closed, or closed in the wrong order | <strong><em>Hot</strong></em> | lesson 2 |
| the same id twice | two elements with id="total" | lesson 2 |
| an element where it may not go | a div inside a p, an li outside a list | lessons 2 and 4 |
| a required attribute missing | an img with no alt | lesson 3 |
| an attribute that does not exist | <input requird>, a typing slip | lesson 5 |
| a missing doctype or title | a page that starts with <html> | lesson 2 |
Some of these a script can find in the built page too. Here is one rule, the duplicate id, the way a checking tool applies it:
<p id="total">Cart total: ₹500</p>
<p id="total">Delivery: ₹40</p>
Checked in Chrome
- (the slip: the rule finds an id used twice)
The rule collects every id on the page and compares the count with the count of different ones. Two elements, but only one different id: one id is used twice.
A second checker inside Chrome
DevTools has an Issues tab (in its More tools menu). Chrome lists problems it noticed on the page there, such as form boxes with no label. It is not a full validator, but it is always one click away.
Worked example 4
A student pastes a page into the validator and gets 14 errors. The first says an element was never closed, around line 12. What is the best order to work in?
What we have: a long list of errors, the first one about an unclosed element
What we need: a way through the list that takes the least work
The plan: fix the first error, check again, and repeat
- One unclosed element makes everything after it look misplaced, so it can cause many of the 14 errors by itself.
- So fix line 12 first: close the element.
- Check again. Several errors usually vanish with that one fix. Repeat from the new first error.
Fix the first error, check again, and repeat, until the list is empty.
Check: each round removes the error most likely to have caused the others, so the list shrinks fastest.
A path that fails: Working from the bottom of the list up. Many of the errors there are echoes of the first one, and fixing them by hand changes HTML that was not wrong.
When you are stuck: the validator
Fix only the first error, then press Check again.
Read the line and column it gives; the slip is often just before that point.
Warnings are advice; errors break the rules. Clear every error before the page goes online.
Your turn
Why can the browser not tell you about a stray closing tag?Tap to reveal
- What does the browser do with it while reading the page?
Because it drops it while building the page, so the built page holds no trace of it.
Where is the W3C's validator?Tap to reveal
- Its address starts with validator.
At validator.w3.org.
A validator lists 9 errors. Which do you fix first?Tap to reveal
- One slip can cause the ones after it.
The first one, then check again.
Did you know?
The first validators
The first online HTML validator was written by Dan Connolly and Mark Gaither, and announced on 13 July 1994. Gerald Oskoboiny then built a friendlier one, called The Kinder, Gentler HTML Validator. He began working for the W3C in September 1997, and on 18 December 1997 the W3C announced its own validator, based on his work.
Why it fits here: The validator.w3.org of this topic grew from those first two validators.
Sources: W3C: About the Markup Validation Service; Wikipedia: W3C Markup Validation Service
Liberal in what you accept
In January 1980 Jon Postel edited the standard for TCP, the Transmission Control Protocol. Its section on robustness says: be conservative in what you do, be liberal in what you accept from others. The idea is also known as Postel's law. Browsers are liberal with HTML: the HTML standard defines how to read a page whether it is syntactically correct or not.
Why it fits here: This is why the browser of this topic never complains, and why a validator, strict where the browser is forgiving, is needed.
Sources: RFC 761: DoD standard Transmission Control Protocol; Wikipedia: Robustness principle; HTML Standard (WHATWG): parse errors
In one line
The browser repairs HTML silently, so check every page with the W3C validator at validator.w3.org: fix the first error, check again, and repeat; DevTools' Issues tab is a quick second check.
Putting your first page online
At a glance
Many companies host static sites for free: GitHub Pages, Cloudflare Pages, which serves this Study Room, and Netlify, among others. GitHub Pages can be done entirely in the browser: make a free account, create a public repository, upload index.html, and switch Pages on.
After a minute or two the page is live at YOUR-NAME.github.io/REPOSITORY/. On such a project site, use relative paths. A path that starts with a slash starts at the top of github.io itself, outside your project's folder, so the link leads to a page that is not yours.
Take a guess: Can a whole website be put online without paying anything?
Now the real thing. Many companies host static sites for free: GitHub Pages, Cloudflare Pages (which serves the Study Room you are reading now) and Netlify, among others. This section uses GitHub Pages, because it can be done entirely in the browser, and because the Git step later uses GitHub for everything else.
The page
Start with a complete page, saved on your laptop as index.html, the name the host sends for a bare address:
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Asha's first page</title>
<meta name="description" content="My first page on the web, made in the Tech School's HTML step.">
</head>
<body>
<header><h1>Hello from Pune</h1></header>
<main>
<p>This page is my first one online. I made it with HTML alone.</p>
</main>
<footer><p>Made by Asha, 2026</p></footer>
</body>
</html>
Checked in Chrome
- a doctype and a language
- a title and the viewport tag
- a header, a main and a footer
The steps, with GitHub Pages
The words on GitHub's buttons change from time to time; if one is different, look for the nearest match. Each step says why it is there.
- Make a free account at github.com. GitHub keeps your files and will serve them.
- Create a new repository: the plus sign at the top, then New repository. A repository is a project folder that GitHub keeps for you. Name it, for example, first-site, and make it Public, since free accounts serve Pages from public repositories.
- Upload index.html: in the new repository, choose Add file, then Upload files, and drop the file in. Then press Commit changes. A commit is a saved version; the Git step explains it fully.
- Switch Pages on: open the repository's Settings, then Pages. Under the source, choose to deploy from a branch, pick the branch main and the folder / (the root), and press Save.
- Wait a minute or two, then refresh the Pages settings. The address of your site appears:
https://YOUR-NAME.github.io/first-site/, with your user name in place of YOUR-NAME. Open it on your phone: your page is on the web, with HTTPS, for anyone.
To update the page, upload the changed file again in the same way and commit. A minute later the site shows the new version. If it does not, your browser may be showing a copy it saved; press Ctrl and Shift and R to reload it fresh.
A trap on a project site: the leading slash
Look at the address again: the site lives in a folder, /first-site/, not at the top of github.io. Lesson 3's root-relative paths, the ones starting with a slash, start at the top of the host, so they jump out of your folder.
<!-- in index.html, opened as https://asha.github.io/first-site/ -->
<a href="/about.html">About me</a>
<a href="about.html">About me</a>
Checked in Chrome
- the root-relative link leaves the site's folder: /about.html is not yours
- the relative link stays inside it: /first-site/about.html
So on a project site, use relative paths such as about.html and images/logo.svg. A repository named exactly YOUR-NAME.github.io is served at the top of the address instead, where a leading slash works too.
Paths from your laptop
A path such as C:\Users\asha\site\photo.jpg or file:///home/asha/site/photo.jpg names a place on your laptop. It works only there. Online, every path must be relative to the page, or a full https:// address.
Worked example 5
Asha's site at https://asha.github.io/first-site/ shows its page, but the logo is missing. The page has <img src="/images/logo.svg" alt="Asha's logo">, and the repository has images/logo.svg. Find the fault and fix it.
What we have: a picture with a root-relative path on a project site
What we need: the address the browser asks for, and a path that reaches the file
The plan: work the path out from the page's address, as the browser does
<!-- the path as written, and the fix, as links so that nothing loads in this preview -->
<a href="/images/logo.svg">as written</a>
<a href="images/logo.svg">the fix</a>
Checked in Chrome
- as written, the browser asks for /images/logo.svg, outside the site's folder
- without the leading slash, it asks for /first-site/images/logo.svg, which exists
Remove the leading slash: src="images/logo.svg".
Check: the second check works the new path out from the page's address and lands on the real file.
Another way: Write the full folder into the path, src="/first-site/images/logo.svg". It works, but breaks again if the repository is ever renamed, so the relative path is better.
When you are stuck: publishing
The bare address gives a 404: is the file called exactly index.html, at the top of the repository?
A picture or link is missing: work its path out from the page's address; on a project site, avoid the leading slash.
The old version still shows: wait a minute, then reload with Ctrl and Shift and R.
Your turn
What is a repository on GitHub?Tap to reveal
- It holds a project's files.
A project folder that GitHub keeps for you.
On https://asha.github.io/first-site/, which file does href="/about.html" reach?Tap to reveal
- A leading slash starts at the top of the host.
/about.html, outside the site's folder.
You uploaded a fix but still see the old page. What do you try?Tap to reveal
- The browser may have saved a copy.
Wait a minute and reload fresh with Ctrl and Shift and R.
Did you know?
Free, within limits
GitHub says Pages is for hosting a website about yourself, your organization or your project. A published site may be no larger than 1 GB, with a soft limit of 100 GB of traffic a month. Pages is not meant to be free hosting for an online business or a shop: GitHub's own rules say so.
Why it fits here: The first page of this topic, like a portfolio or a project's notes, fits well inside those limits.
Sources: GitHub Docs: What is GitHub Pages?; GitHub Docs: GitHub Pages limits
The host of this very site
Cloudflare Pages, which serves this Study Room, was announced as a beta in December 2020 and became generally available on 12 April 2021. On its free plan a site can hold up to 20,000 files and run 500 builds a month. A build runs each time new code is pushed to the site's repository.
Why it fits here: The page you are reading went online the way this topic shows: a folder of files, sent to a free host.
Sources: The Cloudflare Blog: Cloudflare Pages is now Generally Available; Cloudflare Docs: Pages limits
In one line
A free host such as GitHub Pages serves your folder: upload index.html to a public repository, switch Pages on, and open YOUR-NAME.github.io/REPOSITORY/. On such a project site, use relative paths, not a leading slash.
Your own name, and the padlock
At a glance
A market stall known as the third stall from the gate is hard to find; a painted signboard fixes that. A domain name such as ashastores.in is the signboard. You rent it each year from a registrar, and point it at your host with a DNS record.
HTTPS seals everything between the browser and the server. It needs a certificate, which free hosts set up by themselves. On an HTTPS page, every full address should start with https://, because a picture or a script loaded from an http:// address, called mixed content, travels unsealed.
Take a guess: If a page loads over HTTPS, does that prove the site is honest?
A stall in a market is known as "the third stall from the gate". Once it has a painted signboard, "Asha Stores", people can find it by name, tell friends, and look it up. YOUR-NAME.github.io/first-site/ works, but it is the third stall from the gate. A domain name of your own, such as ashastores.in, is the signboard.
A name for a site, such as ashastores.in, that you rent each year from a company called a registrar. The part after the last dot, .in or .com, is the top-level domain.
Getting one
- Choose and rent the name from a registrar. Many sell .in and .com names; a year usually costs from a few hundred rupees to about a thousand, depending on the ending and the seller. Check the renewal price too: it is often higher than the first year's.
- Point the name at your host. In the registrar's settings, you add a DNS record, a line that tells the world's DNS which computer answers for the name, exactly the name-to-number lookup of lesson 1. Your host's guide says which record to add.
- Tell the host the name. On GitHub Pages, that is the Custom domain box in the repository's Pages settings; other hosts have the same idea under another name.
- Wait, from minutes to a day, while the new record spreads to DNS servers around the world.
A DNS record for a site on GitHub Pages often looks like this line in the registrar's table. It says: the name www.ashastores.in is another name for asha.github.io.
A DNS record
www.ashastores.in CNAME asha.github.io
A CNAME record (canonical name) points one name at another name. Other kinds point a name straight at a number. You do not need to remember them now: the host's guide gives the exact record, and you copy it.
HTTPS: the padlock, for free
Lesson 1 showed that HTTPS seals everything between the browser and the server. To offer it, a site needs a certificate, a file that proves the site really is ashastores.in. Certificates once cost money every year. Today a non-profit called Let's Encrypt gives them free, and hosts such as GitHub Pages, Cloudflare Pages and Netlify set them up by themselves. On GitHub Pages, tick Enforce HTTPS in the Pages settings once your domain works.
Browsers now mark plain http:// sites as Not secure, and search engines prefer HTTPS sites. There is no reason left for a site without it.
Mixed content: one http:// spoils the padlock
An HTTPS page that loads a picture or a script from an http:// address has mixed content: one part of the page travels unsealed. Browsers block such scripts, and for pictures they try the https:// address instead or show a warning. The rule is simple to check: every full address on the page should start with https://.
<a href="https://www.irctc.co.in/">Book trains</a>
<a href="https://mausam.imd.gov.in/">Weather</a>
<a href="http://old-shop.example/">Our old site</a>
Checked in Chrome
- (the slip: one address still starts with http://)
The check finds every element with an address and counts those starting with http:. One is left: the old site's link. A link is not loaded with the page, so it does no harm to the padlock, but it sends the visitor to an unsealed site. For a picture or a script, the same slip is mixed content: the browser upgrades it or blocks it, and the picture can fail to show.
Worked example 6
Asha bought ashastores.in and pointed it at her GitHub Pages site. The page opens at http://ashastores.in, but Chrome says Not secure, and the logo, written as src="http://ashastores.in/images/logo.svg", sometimes fails. What two things should she do?
What we have: a working domain, no padlock, and a picture with an http:// address
What we need: the steps that give the site HTTPS and fix the picture
The plan: turn HTTPS on at the host; then make every address on the page relative or https://
- In the repository's Pages settings, tick Enforce HTTPS. GitHub then gives the domain a free certificate and sends every http:// visitor to https://.
- The logo's full http:// address is mixed content on an HTTPS page. Since the logo is on her own site, the best fix is a relative path:
src="images/logo.svg".
<a href="images/logo.svg">the logo, by a relative path</a>
Checked in Chrome
- from the HTTPS page, the relative path stays on https://
Tick Enforce HTTPS, and write the logo's path as images/logo.svg.
Check: the check works the relative path out from the HTTPS page and lands on an https:// address, so nothing travels unsealed.
When you are stuck: domains and HTTPS
A new domain does not open yet: wait, since DNS records take time to spread.
Follow the host's own guide for the exact DNS record; copy it, do not invent it.
No padlock: switch HTTPS on at the host, then look for any http:// address left on the page.
Your turn
What is the company you rent a domain name from called?Tap to reveal
- It keeps the register of names.
A registrar.
What does a DNS record for your domain do?Tap to reveal
- Remember lesson 1's lookup.
It tells DNS which computer, or which other name, answers for your domain.
What is mixed content?Tap to reveal
- An HTTPS page, and one part that is not.
An HTTPS page that loads something from an http:// address.
Did you know?
A lock that many misread
Browsers have shown a lock for HTTPS since early versions of Netscape in the 1990s. In 2013 only 14% of the top million sites supported HTTPS; by 2023, over 95% of page loads in Chrome on Windows used it. Chrome's research in 2021 found that only 11% of participants understood the lock's precise meaning, while nearly all phishing sites use HTTPS too. So in May 2023 Chrome announced it would replace the lock with a tune icon.
Why it fits here: The HTTPS of this topic seals the connection; it says nothing about whether the site itself is honest.
Free certificates since 2015
Let's Encrypt is a free, automated and open certificate authority, run for the public's benefit by the Internet Security Research Group. It gives people the certificates they need to enable HTTPS for websites, for free. It issued its first certificate on 14 September 2015.
Why it fits here: The free certificates that hosts in this topic set up by themselves are the kind Let's Encrypt began to issue in 2015.
Sources: Let's Encrypt: About; Let's Encrypt: Our First Certificate Is Now Live
In one line
A domain name is rented yearly from a registrar and pointed at your host with a DNS record. HTTPS needs a certificate, which free hosts set up by themselves, and every full address on an HTTPS page should start with https://.
Where it is used
Every site you visit went through these steps once: a host, a name, a certificate, and a head that shapes how it looks before it is opened.
| What you learned | Where it is used | A real example |
|---|---|---|
| static hosting | portfolios, documentation, small business sites, this Study Room | a developer's portfolio on GitHub Pages, linked from their CV |
| index.html and folder addresses | every static site | a college club's site where /events/ opens events/index.html |
| the meta description | every page that should be found by search | the grey line under a shop's name in a search result |
| the favicon | every site | the small logo that marks a bank's tab among twenty others |
| Open Graph tags | every page that is shared | a news story's card in a WhatsApp group, with its photo and headline |
| the validator | before every release | a team that will not publish a page with validator errors |
| a domain and DNS | every business site | a bakery's own .in name pointed at its free host |
| HTTPS | every site today | the padlock on a school's admissions form |
Mistakes and debugging
Most of these only show once the page is online, which is why they surprise people.
1. The home page is not called index.html
The bare address gives a 404. The fix: rename the home page index.html, at the top of the folder.
2. Capitals that do not match
Photo.JPG on the server, photo.jpg in the page: the picture is missing online but fine on the laptop. The fix: small letters for every file name and path.
3. A path from the laptop
<a href="file:///C:/Users/asha/site/about.html">About me</a>
Checked in Chrome
- (the slip: a file: address, which exists only on Asha's laptop)
The fix: a relative path, href="about.html".
4. A leading slash on a project site
On YOUR-NAME.github.io/first-site/, /images/logo.svg leaves the site's folder. The fix: images/logo.svg.
5. A relative og:image
<meta property="og:image" content="images/share.jpg">
Checked in Chrome
- (the slip: the card's picture is not a full https:// address, so apps cannot fetch it)
The fix: content="https://ashastores.in/images/share.jpg".
6. Publishing without checking
Errors the browser hid, found by visitors instead of by you. The fix: the validator, the keyboard test of lesson 7, and a look on a real phone, before every release.
The debugging corner: is it the page or the host?
When something works on the laptop but not online, open the online page with DevTools' Network tab and reload. Every file the page asked for is listed with its full address and its status. A 404 there shows the exact address that was tried; compare it, letter by letter, with where the file really is in your repository.
Quick card
The lesson on one card, and the end of the HTML step.
A page ready to go online
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Asha Stores | Kothrud, Pune</title>
<meta name="description" content="Fresh vegetables every morning, delivered free above ₹499.">
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><circle cx='8' cy='8' r='7' fill='orange'/></svg>">
<meta property="og:title" content="Asha Stores, Kothrud">
<meta property="og:image" content="https://ashastores.in/images/share.jpg">
</head>
<body>
<a href="#content">Skip to main content</a>
<header><h1>Asha Stores</h1><nav><a href="offers/">Offers</a></nav></header>
<main id="content"><p>Fresh today.</p></main>
<footer><address>Shop 4, MG Road, Pune</address></footer>
</body>
</html>
Checked in Chrome
- doctype and language
- viewport, and a description that fits
- a favicon, and a full https:// address for the shared picture
- a folder link ending in a slash
- no http:// or file: address anywhere
| Idea | In one line |
|---|---|
| hosting | a server sends your folder's files; a static site is files sent as they are |
| index.html | what a host sends for a folder's address, so the home page's name |
| the trailing slash | link to folders as /offers/, so relative links inside work |
<meta name="description"> | the grey line in a search result; one per page, about 150 characters |
<link rel="icon"> | the favicon, the tab's picture |
<meta property="og:..."> | the title, line and picture of a shared link; og:image as a full https:// address |
| validator.w3.org | the proofreader: fix the first error, check again, repeat |
| GitHub Pages | a public repository, Pages on, YOUR-NAME.github.io/REPOSITORY/; relative paths |
| a domain name | rented yearly from a registrar, pointed at the host with a DNS record |
| HTTPS | free certificates from the host; no http:// addresses on the page |
That completes the HTML step: structure, text, links, pictures, lists, tables, forms, meaning, access for everyone, and a page online. The next step, CSS, gives all of it its looks.
The story: The frame stands
You get the panel ready for the tower. Its front file gets the name the keepers look for. Its head gains the lines that shape it in the city directory and in shared notices. The proofreader's list runs to nine faults; you fix the first, check again, and the list shrinks to nothing.
You raise it. A minute later, across the city, your notice shines on the tower's glass with the padlock beside it. Tobin marks the Masons' Hall done in his book. "The frame stands," he says. "Next, Meher's Tailors will teach you to dress it."
Reagents gathered: host, index.html, validator, repository, domain name.
Sources
- MDN Web Docs (Prose CC BY-SA 2.5 or later; code samples added since 2010-08-20 CC0 (its licensing page, read 2026-10-26); reused with credit)
- HTML Living Standard (WHATWG) (CC BY 4.0: "Copyright WHATWG (Apple, Google, Mozilla, Microsoft). This work is licensed under a Creative Commons Attribution 4.0 International License" (its acknowledgements page, read 2026-10-26); reused with credit)