Learn HTML · Lesson 8 of 8 · about 15 minutes
Put it online
Your site works on your computer. In this last lesson it goes online, at an address you can send to anyone, and you'll learn how to keep it up to date and, if you like, give it a domain name of your own.
Before you upload: a last check
Most problems that appear once a site is online come from a few mistakes you already know about. Go through your pages once more:
- File and folder names are lowercase, with no spaces, and every link and image uses the same spelling (lesson 3).
- No address starts with
C:\orfile://, and none uses\(lessons 3 and 4). - Every page has its own
<title>.
If you installed pagehaus in lesson 6, it does this for you. In your my-site folder, run
pagehaus check: it follows every link, includes and all, and lists anything broken, including names
that only match on your own computer.
Something still not right? Compare your files with Sam's finished site, every file of it as it is at the end of this lesson.
A page for addresses that don't exist
Sooner or later someone will follow an old link or mistype an address. A web server then answers "404: not
found", and shows a plain error page. Make your own, called 404.html, in the top of your site, and
Pagehaus shows it instead, with your menu, so the visitor can find their way:
<!--#set var="title" value="Page not found" -->
<!--#include virtual="/includes/head.html" -->
<h1>Page not found</h1>
<p>Sorry, there's nothing at this address. It may have moved,
or there may be a typo in the link.</p>
<p><a href="/index.html">Go to the home page</a> or
<a href="/recipes.html">see all the recipes</a>.</p>
<!--#include virtual="/includes/footer.html" -->
This one uses the head include from lesson 6; a full page with the two include lines works just as well. One
thing matters: every address in a 404 page must start with /, including the stylesheet's. The
page is shown at whatever address the visitor asked for, such as
/recipes/old/cake.html, so relative addresses would point at the wrong folder.
Tell search engines what your site is
Search results show your page's <title> as the link, and a line or two about the page under it.
You can write that line yourself, with one more <meta> in the <head>:
<title>Sam Rivera</title>
<meta name="description" content="Weekend baker in Toronto: sourdough, rye and birthday cakes, with the recipes I actually use.">
Describe each page in a sentence that would make you click: around 150 characters, saying what's there. Without it, search engines pick some text from the page, which is often the menu.
Get a free site
A website is online when its files are on a web server: a computer that's always on and connected, answering browsers that ask for your pages. A host runs that for you. Pagehaus is one, made for exactly the kind of site you've built, and everything in this course works there as written: includes, the contact form, the 404 page.
- Sign up and pick a name for your site. It becomes your address:
https://yourname.pagehaus.site/. The Free plan is enough for this site and much more, and needs no card. - Confirm your email address from the message we send you. Your contact form needs it.
Upload your files
- Open your site's Files tab.
- Open your
my-sitefolder on your computer, select everything in it, and drag it all onto the page. Drag what's inside the folder, not the folder itself, so thatindex.htmlends up at the top of your site. (A .zip of the folder works too: Pagehaus unpacks it.) - Open your address. That's your site, online, over HTTPS, for anyone in the world.
Click through every page, send yourself a message with the contact form, and try an address that doesn't exist to see your 404 page. Then open it on your phone: lesson 5's layout should fit.
Keeping it up to date
The copy on your computer is your master copy: make changes there, check them, then upload the files you changed. A file with the same name replaces the old one, and the address stays the same.
- Small changes: the Files tab has an editor, with a preview that shows includes. If you edit there, remember to make the same change on your computer, or download the file.
- Mistakes: earlier versions of your site are kept in version history (for a week on Free, longer on paid plans), so you can go back.
- Many files, or often: an SFTP program such as FileZilla
uploads only what changed, and
pagehaus deployuploads the whole folder in one command, after checking it (how).
Your own domain name
An address like samrivera.com is easier to remember and say, and stays yours if you ever change
host. It takes three steps:
- Buy the domain from a domain registrar (Namecheap, Porkbun, Cloudflare and many others).
A
.comcosts around 10 to 20 US dollars a year. Watch for a cheap first year with an expensive renewal. - Add it to your site on the Domains tab. Custom domains are on the paid plans (see pricing).
- Point the domain at Pagehaus by adding the few DNS records the Domains tab shows you, at your registrar. When they're in place, the tab says Live, and HTTPS is set up for you. Custom domains has the details.
An email address at your domain, like hello@samrivera.com, is separate from the website: see
email at your own domain.
Being found
Search engines find new sites by following links, so it can take a few days to a few weeks before your site shows up. Two things help: a link to it from somewhere that's already known (your social media profiles, a friend's site), and Google Search Console, where you can tell Google your site exists and see how people find it.
Check your work
- Your site has a
404.htmlwhose addresses all start with/. - Your home page has a
<meta name="description">. - Your site is online: every page opens, every image shows, and the menu works everywhere.
- A message from your contact form arrived in your inbox.
- You've sent your address to someone.
Where to go from here
That's the course: you've built a website from an empty file, and it's online. Some places to go next:
- MDN Web Docs, by the makers of Firefox, is the best reference for every HTML element and CSS property, with examples.
- Templates are finished sites, written in the same plain HTML and CSS you've learned, to read, borrow from, or start your next site with.
- Pagehaus can add a blog to your site, and the guides answer more specific questions.
- Look at sites you like with the browser's Inspect tool (lesson 5). You can now read everything it shows you.