By the end of today you can
- Inspect a page and recognise its main elements and attributes
- Distinguish Markdown, templates, generated HTML, and the live document
- Make and verify a small lasting change to the shared layout
- Check headings, links, images, and the skip link
No HTML reference to memorise, and no JavaScript.
Inspect the article
Start hugo server in your Chapter 3 project (or checkout companion branch chapter-03 in ssg-playground) and open:
http://localhost:1313/articles/first-learning-note/Right-click the main heading and choose Inspect or press F12 (Ctrl + Shift + I / Cmd + Option + I). Look for Elements (Chrome, Edge) or Inspector (Firefox):
<h1>My first learning note</h1>Then find the first paragraph’s p, and What I tried’s h2.
Nesting and void elements
Close inner elements before the ones around them:
<p>Please <strong>check the link</strong> before publishing.</p>- Straight quotes around attribute values, spaces between attributes
- Indentation helps reading; the markup creates the structure
img,meta, andlinkare void elements: never write</img>
A working address with a misleading label is still a poor link.
What is in that footer
- Nesting: the link sits in a paragraph, inside
footer &shows an&;<and>show<and>footer-noteis a class: a label with no style yet, used in Chapter 5{{ ... }}is processed by Hugo, before the browser sees it
<a href="/about/">about this notebook</a>That is what the browser actually receives.
From content to browser
| Form | Where you see it |
|---|---|
| Content source | content/articles/first-learning-note/index.md |
| Layout source | layouts/all.html, with {{ .Title }} and {{ .Content }} |
| Generated HTML | View Page Source, or files made by a build |
| Live document | Elements or Inspector, including your edits |
The live document is the DOM: Document Object Model.
Edit the source, not the output
- Never edit a generated
public/.../index.html: the next build overwrites it - View Page Source shows the response; the inspector shows the live tree
- You may see extra code Hugo adds for live reload
If the page literally shows {{ .Title }}, you opened the layout file itself. Open the Hugo preview address instead.
Heading levels are structure
- One
h1per page, from the layout;h2for sections,h3inside them - A bold paragraph looks like a heading but is not one
- An
h2used just for big text gives a misleading outline
Screen-reader users jump between headings, so the difference matters.
Two big titles? You probably wrote # My first learning note in the body as well. Remove it; do not hide it with CSS.
Break the skip link on purpose
- In
layouts/all.html, change onlyhref="#main"tohref="#missing-main" - Save and reload: it still looks like a link, and Hugo builds
- Search the inspector for
id="missing-main": nothing - Restore
href="#main"and repeat the keyboard check
Matching words in the address bar are not enough: check that the target exists.
Which file do I edit?
| What is wrong | Look first at |
|---|---|
| The article’s title | Its front matter title |
| A heading or sentence in the body | The page’s Markdown |
| A menu label or the footer, everywhere | layouts/all.html |
| The site name, everywhere | title in hugo.toml |
| Font, colour, or spacing | static/css/site.css, after the HTML |
Page writing stays in Markdown; shared structure stays in the layout.
Recognise: a data table
<table>
<caption>Notebook content</caption>
<tr><th scope="col">Section</th><th scope="col">Purpose</th></tr>
<tr><td>Articles</td><td>Learning notes</td></tr>
</table>tra row,tha header cell,tda data cell- The
captionnames the table;scope="col"ties a header to its column
Tables are for tabular data, not page layout. Do not add this to your site.
Recognise: a labelled input
<label for="contact-email">Email address</label>
<input id="contact-email" name="email" type="email">- The label’s
formatches the input’sid nameidentifies the value when it is sent- A placeholder is not a label
This HTML alone sends nothing and stores nothing. Real forms come in the interaction chapter.
Judge an agent’s proposal
| Proposal | What to examine |
|---|---|
“Make the h1 a paragraph so it is smaller” | It removes the main heading. Change size with CSS. |
| “Make every link say Read more” | Can visitors still tell the destinations apart? |
Ask which files and elements it will change, and why.
A confident explanation does not replace inspecting the result.
When something goes wrong
| What you see | What to check |
|---|---|
| The footer change vanishes on reload | You edited only the DOM: save it in the layout |
| Hugo reports a template error | Restore the relURL link exactly |
The page shows {{ ... }} | Open the Hugo address, not the file |
& shows literally | You wrote &amp;, or used a code block |
Browsers recover from bad markup: inspect, do not trust appearance.
Completion check
- I can find the
h1, a body heading, a link, and the image in the inspector - I can explain why a browser-only edit vanishes on reload
- I recognise elements, attributes, nesting, and void elements
- I can tell Markdown, layout, generated HTML, and the DOM apart
- My new footer appears on every page, and its link works
- The skip link and
mainmatch again - I saved a Chapter 4 checkpoint