Wagtail Unboxed episode 04 5:38
Templates and static files
The teal egg finally goes. We delete Wagtail's welcome page, write a real base template, list child pages from the page tree, and style the site with plain CSS.
What this episode covers
Where the welcome page lives and how to delete it properly; how Wagtail finds a template from the model name, and the two places templates can live; and a real base.html with a header, main and footer, keeping the generated bits that are worth keeping.
Then the template work itself: pageurl, slugurl and the richtext filter, why you should never build links from url_path, and listing child pages with get_children.live straight from the page tree.
Plus the ten-minute trap nobody warns you about: you write your CSS, reload, and the page is still completely unstyled — with nothing wrong with your code. We cover why studio.css ships at 0 bytes, how {% static %} resolves it, and the browser-cache trap, with proof of what is actually happening.
No build step, no framework, no Node. Plain CSS, hand-written, for the whole series.
Chapters
- 0:00 Four episodes in, still an egg
- 0:16 Where the welcome page lives
- 0:30 How Wagtail finds a template
- 0:46 Two places templates live
- 1:06 base.html — keep the head
- 1:23 Header, main, footer
- 1:35 pageurl, slugurl, richtext
- 1:58 Never build links from url_path
- 2:14 Listing child pages from the tree
- 2:32 The stylesheet that ships empty
- 2:56 static and STATICFILES_DIRS
- 3:14 You write the CSS. Nothing changes.
- 3:30 What's actually happening
- 3:52 Hard-reload
- 4:09 The result
- 4:22 The About page
- 4:36 One media query
- 4:50 Why the 404 page hasn't changed
- 5:09 Commit and tag
- 5:12 Next episode
Versions on screen
Wagtail 7.4.3 · Django 6.1.1 · Python 3.12. Recorded on Windows; macOS and Linux commands are in the repository for every episode.