← All writing

A static site that checks itself

The build is only finished when the output has been read back.

Web performanceStatic sitesSEO
The satyajiit.dev homepage: the headline “It started with a what if.” above the OpenAlly chapter, with app screens on a laptop and two phones.
The site you are reading, built once and checked before it ships.

This site has no application server. Every page is an HTML file produced ahead of time by a Next.js static export and served from Firebase Hosting. That keeps hosting simple, and it moves all the interesting failures to one place: the build.

A static site fails quietly. A broken image path, a page with two main headings, a feed that lost an article or a service worker that caches the wrong thing all deploy perfectly well. Nobody sees an error. So I treat the build as two halves: one that produces the site, and one that reads it back and refuses to finish if something is wrong. This piece explains that practice and why I think it’s worth the effort, even for a small personal site.

In short

  • Check every content file against a schema before anything is rendered.
  • Generate every output from the same documents, then read the finished site back and stop the build on any mismatch.
  • Build the offline cache from the output, and write down what the host must do.

Validate content before rendering it

All the writing, case studies and page copy live in Markdown files, each with a block of structured details at the top: title, description, date, cover image and so on. Before anything is rendered, every file is checked against a schema. A description has to be a sensible length for a search result. A date has to be a real date. A cover has to point to an image that exists.

The schema also holds editorial rules that are easy to forget. A product figure, such as a download count or a rating on a case study, is only allowed with a public source or an explicit note that the owner reported it. Every image needs alternative text. An article’s body starts below the page title, so a page can never end up with two. A published piece has to have real substance, so an empty draft can’t slip into a list.

Rules like these are cheap to write once and expensive to remember by hand every time. Putting them in the build means they apply to the hundredth article as strictly as the first.

Generate everything from one source

The same documents feed everything else the site publishes: responsive images at a few fixed widths, social preview cards for each page, a sitemap, an RSS feed, a plain Markdown copy of every page, and llms.txt files for tools that prefer plain text.

Generating them all from the content has one big advantage: they can’t drift apart. Rename an article and its social card, sitemap entry and feed item change with it. Unpublish a draft and it disappears from all of them, because the generated folders are rebuilt from scratch each time rather than patched.

Where an output involves a judgement, the build records it. A couple of writing covers, such as the one on Giving AI an Android phone, are delivered at 4K from smaller source art. The code says that plainly, so a filename never implies more than the image really is.

Offer each page in more than one format

Each page links to a Markdown version of itself. That copy isn’t a summary. It includes the full article, screenshot captions, product figures with their sources and the dates they were checked, and the list of references.

Two versions of the same page are only useful if they agree, which brings me to the second half of the build.

Read the finished site back

After the pages are built, a verification step opens every published route and inspects the HTML on disk, the same files the host will serve. Each page must have:

  • exactly one main heading
  • a canonical URL
  • a title no other page uses
  • structured data and a social image

Every internal link and image has to point at a file that really exists. A link to a missing page stops the build and names both the page and the link.

Then it compares formats. Every article’s text must appear in its Markdown copy, and that copy must appear in the full plain-text export. Captions, product figures and their check dates are compared one by one. Large covers are opened and measured to confirm their real dimensions. The archived previous version of the site must be absent. Even the advertising setup is checked the same way: the publisher file has to be right, and the right script has to be on every page.

Simple checks, quiet mistakes

Each check is simple. Together they mean a whole category of mistakes, the quiet ones, can’t reach the live site.

Build the offline cache from the output

Once you’ve visited, the site works offline through a service worker. I generate that worker after the build, from the finished output, so it can’t list a file that doesn’t exist or miss one that does.

It caches the pages and the files they need to draw, and deliberately leaves out films, feeds and other large or optional files. There’s a size budget for each cached file and for the cache as a whole, so an oversized image added by accident fails the build instead of quietly costing every visitor bandwidth.

Updates get the same care, because a service worker is easy to get wrong. Each version of the cache belongs to exactly one build. When a new version installs, it clears out the old ones and refreshes open tabs once, with guards so a tab can never get stuck reloading. web.dev’s guide to the service worker lifecycle explains why this stage deserves so much attention.

Write down what the host must do

A service worker only behaves if the server does its part, so I wrote that down as a contract the hosting configuration follows. The worker file itself must never be cached for long. Directory addresses redirect to one consistent form. Fingerprinted assets can be cached for a long time, while pages and the worker stay fresh. Films support partial requests, so one can start playing without downloading the whole file.

Writing it down turned out to matter as much as the code. When I change hosting settings, the contract tells me what I mustn’t break.

Know what the checks don’t tell you

What the checks can’t prove

These checks prove the site is internally consistent. They don’t prove it feels good on an old phone.

A separate browser test suite runs automated accessibility checks based on WCAG on every page and looks for sideways scrolling across a range of screen widths, and I run Lighthouse against a local production preview. Those are lab measurements. They’re useful, and they’re still different from what real visitors experience, which is what Core Web Vitals field data measures.

Testing on physical devices and listening to real screen reader output sit outside all of this, and the project’s verification notes say so. I’d rather keep that list of limits next to the results than let a passing build suggest it measured more than it did. If you want to see what the build produces, the homepage is a good place to start.

Sources & further reading

Another question worth following?

Explore the workGet in touch

A good project often starts here.

Leave me
a what if.

All the places to find me ↗
To Satyajit

There’s an app I wish existed.

Tell me who would use it and what they are trying to do. A rough sketch is plenty to start with.

Talk to me on LinkedInLet’s follow the question.