A static export needs every route decided at build time

Problem

The site is a static export, so every page and file must exist when the build ends. Two routes broke that rule in different ways. The icon route, drawn in code, was treated as something to make on request. The lessons route took a name from the address, and with no lessons written yet it had no names to generate.

Symptoms

What Didn't Work

Solution

The icon was marked as built once with the site:

export const dynamic = "force-static"

The lessons route generated one placeholder page, with a plain line saying there was no lesson yet, while the folder of lessons was empty. Nothing linked to the placeholder, and the placeholder was removed as soon as the first lesson existed. Tests that scanned the built pages were told about the placeholder while it lasted.

Why This Works

A static export has no server to answer a request later. Whatever the site serves must be fixed by the end of the build, so each route has to say either that it is static or exactly which pages it produces.

Prevention