Build your first static website
Turn the three-page site into portable HTML and assets, then prove it works with the What server stopped.
Allow 10–20 minutes. This is an editorial estimate. Continue in the same my-site folder; do not create another starter.
Read
Start at L04. Home shows two working cards, and About and Contact share the layout. No source change is required for this lesson. We will build the same files you have been editing.
A static build resolves the page metadata, layout and components into ordinary HTML. It copies the site's assets into an output folder. This fixed content can be served by a static host without a Rust process or a database. Later lessons add behavior that needs a server; this checkpoint makes no claim that a future CMS, login or editing workflow can run on a static host.
For this local preview, use Python 3's built-in file server. Check python3 --version first. Python is only a preview tool, not a What dependency and not required by your exported website. An existing static-server tool is also suitable if it serves directory index files.
Change
1. Stop What. In the terminal running run-what dev, press Ctrl+C. From my-site, build to the generated dist/ folder. Use a different output folder if you already store important files in a folder named dist.
run-what build --path . --output dist
For the required three-page checkpoint, expect three rendered pages and no skipped pages. Optional exercise pages may add to that count. The important output paths are:
dist/
index.html
about/index.html
contact/index.html
static/
styles.css
app.js
what.css
what.js
images/site-image.svg
The development URL /about becomes about/index.html in the export. A directory-index static host redirects /about to /about/ and serves that file. The navigation links still work. Keep the entire static/ directory with the HTML.
2. Serve the output. From the same project folder, start Python's file server:
python3 -m http.server 8090 --directory dist
Open http://127.0.0.1:8090/. This is a different server and port from the What development server. Do not open the HTML with a file:// URL; links beginning with / need a website root.
The framework stylesheet and browser runtime are included automatically. The fixed pages, image and navigation should also work with JavaScript disabled. There is no need to add a JavaScript build step.
Check
- With What still stopped, open Home, About and Contact directly. Reload each and follow the navigation and card links.
- Check the image, page titles, shared footer and mobile layout. Disable JavaScript in your browser and reload: the same fixed content and links should remain usable.
- Inspect
dist/index.htmlin your editor. There should be rendered HTML instead of<what-content-card>,<slot/>or unresolved#title#. The development inspector and live-reload connection do not belong in the export. - Open a nonexistent path. The static server should return a missing-page response. The output must not contain your project's
data/, sessions, or configuration files.
Do not call this milestone complete until the three pages and their assets work on port 8090 with What stopped. To make the site public later, upload the contents of dist/ to a static host that supports directory index files; choosing and configuring a hosting account is outside this local verification.
Recover
These are anticipated build or hosting mistakes:
- A page is absent or listed as skipped: confirm you built from the project containing the L04 files. Read the build output before uploading anything; a successful command is not proof that every expected page was included.
- The image or stylesheet is missing: serve the whole
dist/folder, includingstatic/, and use an HTTP address. Serving onlyindex.htmlis insufficient. - An edit does not appear: you are viewing a generated snapshot. Change a file in
site/,components/, orstatic/, then run the build command again and refresh. Do not editdist/as your source.
If you need a clean comparison, download the L04 source checkpoint for this lesson. It is a copy of the project at this point, not a separately installed template. It contains source files and a checksum manifest; it excludes sessions and runtime databases. Keep your project and extract into a new folder. For example, after placing that archive in Downloads, stop your dev server and run these commands from the folder that contains my-site:
mkdir my-site-recovery-L04 && unzip -n "$HOME/Downloads/L04.zip" -d my-site-recovery-L04
If the folder already exists, the first command fails and extraction does not run. Pick another new name; do not empty an existing folder. After successful extraction:
cd my-site-recovery-L04
run-what dev
Reapply this lesson there. Optional exercises are not part of the required checkpoint; keep your own variations in your original project.
Try
Optional: change one sentence in site/about.html. Rebuild while Python continues serving dist/, then refresh http://127.0.0.1:8090/about/. The new sentence should appear without starting What. Stop the Python server with Ctrl+C when finished.
Continue
You have a complete fixed website: pages, assets, shared layout, reusable components and portable output. Keep the source project. Later lessons will turn authored cards into data-driven cards and tables before adding editing and publication; those lessons are still being developed.