Building a Blog That Loads in Under a Second
298 words
Table of contents
Most blogs are slow for reasons that have nothing to do with their content. A page of text should not need three seconds and two megabytes to appear. Here’s the mental model I use to keep a static site actually fast.
Ship less#
The fastest byte is the one you never send. Before optimizing anything, take inventory:
- Fonts. A system font stack costs zero bytes and looks native everywhere. If you must use a webfont, subset it and preload one weight.
- JavaScript. Ask what each script does for the reader. Analytics they never see? A framework to render text that Hugo already rendered at build time? Cut it.
- CSS. One small stylesheet, minified and fingerprinted, beats a utility framework you use 4% of.
Let the build do the work#
Hugo renders everything ahead of time, which means the server does almost nothing per request:
hugo --minify
# Pages: 40 | Total in 180 ms
Everything that can happen at build time should: syntax highlighting, image processing, the search index, RSS. The browser gets finished HTML.
Measure the right thing#
Lighthouse scores are a proxy. What matters:
- Time to first byte — mostly your host’s problem; a CDN fixes it.
- Largest contentful paint — usually your hero image. Lazy-load everything below the fold and size images to their rendered dimensions.
- Cumulative layout shift — reserve space for images with width and height attributes, and never inject banners above content.
The traps#
A few things that quietly ruin static site performance:
- Comment embeds that load 500 KB before anyone scrolls to them. Lucent lazy loads giscus for exactly this reason.
- Icon fonts. Inline SVG is smaller, sharper, and doesn’t flash.
- “Just one” third-party script. There is never just one.
Fast is a budget, not a milestone. Spend it on words.