Create the article
Make this folder and file inside the project:
content/articles/first-learning-note/index.md(Or switch to ssg-playground branch chapter-02 where files are prepared)
Then open it in the browser, including the final slash:
http://localhost:1313/articles/first-learning-note/It uses the same layout and styling as the home page: you copied no HTML at all.
Why the file is called index.md
The article has its own folder so its text and image stay together. Hugo calls this a page bundle.
| Source file | Address in the preview |
|---|---|
content/_index.md | / |
content/articles/first-learning-note/index.md | /articles/first-learning-note/ |
The home page uses _index.md; an article uses index.md. Keep both exactly.
Emphasis and short code
My rule is **change one thing at a time**.
I check it *before continuing*.
I edited `content/_index.md` and used `hugo server -D`.**double asterisks**for important words,*single*for emphasis- Backticks around filenames and commands
Showing a command in an article does not run it.
Add your own screenshot
- Capture your home page and save it as a real PNG:
notebook-preview.png(No spaces in filenames! Sample is included inssg-playground) - Put it next to
index.mdin the article folder - Add it to the article:

*My home page after my edits. Screenshot by the author.*Alternative text and captions
- The text in
![...]is alternative text: it describes the image for someone who cannot see it - The italic line underneath is a caption, for everyone
- The image path is just the filename, never
content/articles/... - Leave private tabs and notifications out of screenshots
- Someone else’s image needs permission or a suitable licence
Keep the image within the page
Add these rules at the end of static/css/site.css:
article img { display: block; max-width: 100%; height: auto; border-radius: 0.5rem; }
article pre { max-width: 100%; overflow-x: auto; background: #eae8e1; padding: 0.75rem 1rem; border-radius: 0.5rem; }Large images shrink to fit, and long code blocks scroll with distinct styling.
Break something on purpose
- Change the image filename to
notebook-preview-missing.pngand save - The image fails to load, yet Hugo still builds without complaint
- Read the real filename in the article folder
- Restore
notebook-preview.png, matching spelling and letter case
A plausible-looking reference is not evidence that its destination exists.
Make the article ready
- Read it as a visitor: meaning, headings, links, image, alternative text
- Change the front matter to
draft: false - Stop the server with Ctrl+C and restart it without
-D:
hugo server- Check the article still appears
draft is a publishing switch, not a lock: never use it to hide confidential writing.
Link it from the home page
At the end of content/_index.md, keep everything else and add:
## Latest writing
- [My first learning note](articles/first-learning-note/)The link points to the article’s web address: no content/, no index.md.
Then check the article’s link back home, and the navigation at the top.
Try it yourself
- Add a subsection about one difficulty you met and how you solved it
- Include a numbered procedure or a short code sample
- Check it in the normal preview, without
-D - Follow the home-page link and both article links again
Report what actually happened: do not turn an example into an invented experience.
Save your checkpoint
Stop the preview and copy the whole folder to my-knowledge-site-ch02-backup, next to the project.
| File | Today’s change |
|---|---|
content/articles/first-learning-note/index.md | New article, draft: false |
.../first-learning-note/notebook-preview.png | Your screenshot |
content/_index.md | Latest writing section |
static/css/site.css | Image and code sizing rules |
When something goes wrong
| What you see | What to check |
|---|---|
| The article gives a 404 | The exact path, index.md, and whether it is still a draft |
| It vanished after a restart | draft: true without -D |
| The image does not load | Filename, extension, letter case, and folder |
A link opens a path with content/ | You used a file path instead of a web address |
| Much of the article looks like code | An unclosed three-backtick fence |
Completion check
- My article opens in the normal
hugo serverpreview - Its title is the main heading; sections use sensible levels
- Its links open the right destinations
- The screenshot sits beside
index.mdand displays - Its alternative text describes what the screenshot shows
- I repaired the broken image on purpose
- The home page links to the article
- I saved a Chapter 2 checkpoint