Two small sites, one approach
I built two websites in the same season. One is this one. The other is for a client: a local insurance business, family-run, with ten pages. A home page, an about page, the lines they write, a quote request, the carriers they represent, reviews, contact and a privacy page.
The usual answer for a site that size is WordPress or a hosted site builder. I used neither. Both sites are plain HTML files in an S3 bucket behind CloudFront.
Why no framework
For a site of five to ten pages that changes a few times a month, a content management system brings more to look after than it saves:
- Nothing to patch. There is no core, no theme and no server-side language to keep current.
- No plugins. Every plugin is someone else's code running with access to the site's data.
- No database. Nothing to back up but the files, and nothing on the server to break into.
- Fast. The CDN hands over a file it already has.
- Cheap to host. A bucket and a CDN, with no server running.
- The owner owns plain files. If they ever stop working with me, they keep a folder any web developer can open.
The client site: partials stamped into pages
Ten pages share one header block, one masthead with the navigation, and one footer. Ten hand-edited copies of the same masthead will drift. So the source is split into parts, and a script assembles them:
src/partials/head.html <head> with {{TITLE}} {{DESCRIPTION}}
{{CANONICAL}} {{EXTRA_HEAD}} placeholders
src/partials/masthead.html brand, phones, nav (data-nav="<key>")
src/partials/footer.html people band + footer
src/pages/<name>.html body content only
src/pages.json per-page title, description, nav key,
optional extra_head partial and scripts
That listing is the top of build.py, the build script. It is 125 lines and uses only the Python standard library. For each entry in pages.json it fills the placeholders in the head, marks the current page's link in the navigation, then appends the page body, the footer and the page's scripts. One entry looks like this, with the text trimmed:
"quote": {
"title": "...",
"description": "...",
"nav": "quote",
"scripts": ["/assets/site.js"]
}
The current-page marker is a single regular expression. It finds the link whose data-nav matches the page's key and adds class="current" aria-current="page", so the styling and the screen-reader cue come from the same place.
Asset URLs carry a content hash. Assets are cached for seven days. A changed stylesheet under the same URL would sit in browser and CDN caches until then. So the build appends the first ten characters of the file's SHA-256 to the URL:
digest = hashlib.sha256(local.read_bytes()).hexdigest()[:10]
return f"{path}?v={digest}"
A changed file is a new URL and is fetched at once. An unchanged file keeps the same URL and stays cached. I wrote up the header side of this, and how this site handles it with a date string instead, in cache headers for a static site.
Nothing is indexed until cutover. The site lived on a preview address for weeks before the real domain moved. A preview that search engines index competes with the real site later. By default the build adds a noindex meta tag to every page and writes a robots.txt that disallows everything. Setting SITE_INDEXABLE=1 at cutover flips both. The same run writes sitemap.xml from pages.json, listing every page except the privacy page.
A deploy that refuses
The client's deploy.sh does its steps in a fixed order:
- Run the build, so a stale page can never ship next to a fresh one.
- Stop if there is no
index.html. - Search the built pages for text that must never be published, and stop if any is found.
- Sync the assets with a seven-day cache and the pages with a five-minute cache, deleting anything removed from the source.
- Invalidate the CloudFront cache.
A --dry-run flag shows what would change and touches nothing. Step three is the part I would copy into any site:
if grep -qi "RETIRED PRODUCT NAME" "$SITE_DIR"/*.html 2>/dev/null; then
log_error "REFUSING: a retired product is named on the site"
return 1
fi
The agency no longer writes that line of business. A bad merge, or a paragraph pasted from the old site, could put it back on a page, and a customer would call asking for a policy they cannot buy. A second check refuses the "demonstration only" banner the preview carried, so it can never reach the live site.
This site's deploy has one check of the same kind. It refuses to publish if a privacy sentence I retracted comes back to the home page. The sentence said nothing about a visit is stored. That was not true once CloudFront access logs were on, and the footer now says server logs are kept 90 days.
Each check is one line of shell, costs nothing to run, and exists because of a specific way a page could go wrong in public. That is the cheapest insurance I know against a bad publish.
This site: an index built from the posts
stingrayio.com has no partials. Each page is a hand-written HTML file. The place a list would drift here is the writing section: every post appears on the writing page, and the newest three appear on the home page.
A script, build_writing_index.py, treats each post as the source of truth for its own entry. It reads the title, description, publish date, category and reading time from the post's own tags, then rewrites only the post list on the writing page and the three cards on the home page. Nothing else in either file changes. If I have tightened a summary by hand on the index, that wording wins. A --check flag prints the list without writing anything.
A second script, check_posts.sh, runs before publishing. Across every post it looks for:
- words that must not appear in public writing,
- dashes outside the page title,
- inline styles or scripts, which the site's Content-Security-Policy would block,
- a stylesheet link with the wrong version,
- a stated reading time more than a minute off the body's word count,
- an unclosed paragraph.
It exits non-zero on any finding. Posts live in directories, so their URLs end in a slash, and CloudFront needs a small function to serve index.html for them. That function is its own post: serving a directory from S3 behind CloudFront.
The trade-off
Every change goes through me. The client does not log in and edit a page. I edit the source, run one command, and the change is live within minutes.
For a business that updates its site monthly, that is a good trade. A new carrier, a changed phone number or new office hours is a short email to me. They have no software to patch and no plugin to worry about.
It is the wrong choice for anyone who publishes daily, like a newsroom, or for an owner who wants to fix a typo at ten at night without calling anyone. They need a content management system, and the patching that comes with it.
If you want to try this
- Put anything repeated on every page in a partial, and build pages from a small metadata file.
- Hash asset contents into their URLs, or bump a version string, so long caches are safe.
- Make the preview unindexable by default and flip it with one setting at cutover.
- Make the deploy run the build first, then refuse to publish text you know is wrong.
- Generate lists from the pages they list, never by hand.