· updated

Building this site

I write everything in SilverBullet already, so the website is simply a section of my notes: Website.md and the Website/ folder. A publisher on the home network turns that into static HTML and pushes it to the web host.

Why static

My other website (https:retro.ofpinewood.com) needs search and filters, so it runs a small Node.js app. This site doesn't: it's pages and posts. Static files are faster, cheaper and are more secure[1]. My notes and my home network are never reachable from the internet; the web host only ever sees finished HTML files.

How it works

  1. I write a page in SilverBullet.
  2. The publisher pulls the notes every half hour.
  3. If anything under Website/ changed, it rebuilds the site and copies it to the host with rsync over SSH.

The publisher is a small container on my Proxmox server. It only has a read-only copy of the Website/ part of my notes, and it never writes to them. If a pull or a build fails, the last good version simply stays online.

The structure follows SilverBullet's own layout: a page next to a folder with the same name becomes that folder's index. Posts are just the pages in Website/Posts/ with a date; everything else, like the About page, is a plain page.

Keeping private things private

My notes are full of things that shouldn't be on a website. The build uses the same rules as the retro site:

  • Pages with draft: true are skipped, and links to them become plain text.
  • #private blocks, task lists, comments and everything below a # --- page break are removed.
  • Only images and files that a published page actually uses are copied.
  • Links to notes outside Website/ become plain text.

As a last check, the build scans its own output for things like local network addresses and paths. If it finds any, nothing is pushed.

Images

Photos are embedded the SilverBullet way. The publisher makes thumbnails in a few sizes (WebP with a JPEG fallback), and clicking one opens the original in a lightbox. Location and camera data are stripped from every image, including the originals.

No tracking, no surprises

There are no analytics, no CDNs and no external fonts or scripts: everything comes from this domain. A generated .htaccess adds security headers, including a strict Content-Security-Policy that allows no inline scripts or styles, and redirects everything to HTTPS. JavaScript is only used for the lightbox; every page works without it.

Same notes, same site

The same notes and the same version of the publisher always produce exactly the same files. Pages never contain a build time, and everything is sorted in a fixed order. rsync then only uploads what actually changed.

The admin site

The publisher has a small admin site, only reachable at home and behind a login. It shows the last sync, build and push, lists problems in my notes (a missing post date, a broken link, an image without alt text) and has a preview of the site. "Build and push now" skips the half-hour wait.

The look: the Of Pine Wood UI toolkit

Cream paper, condensed Anton headlines, thin ink rules and small serif labels between rules, like a printed catalogue. That look comes from the Of Pine Wood UI toolkit, a small CSS and JavaScript kit for server-rendered sites, a bit like a very small Bootstrap. The retro site uses it too.

Why a toolkit

It started as the stylesheet of the retro site. For this site I wanted the same look, but not a copy of the CSS that would slowly drift apart. So everything that wasn't specific to the retro site moved into its own package. Both sites install it from my own npm registry and only add a small stylesheet of their own on top.

The rule while building this site: anything generic goes into the toolkit, not into the site. That way the retro site gets every improvement too. The only real difference between the two sites is the accent colour: red for the retro site, forest green here, picked from my pine forest picture.

What building this site added

Version 0.1.0 was what came out of the retro site. Building this one added:

  • Markdown for SilverBullet notes (0.2.0). Both sites are built from my notes, so the markdown plugins for wikilinks, embedded images, callouts and heading anchors now live in the toolkit.
  • Posts (0.2.0): a dated list, byline, tags and links to the previous and next post.
  • Admin pages (0.2.0): the login and status pages of the retro site, now shared with this site's publisher.
  • A colour per site (0.3.0). A separate warning colour keeps warnings red whatever the accent is.
  • Links between the sites (0.4.0): the footer shows the badges of the other Of Pine Wood sites.
  • Small fixes (0.5.0 and 0.6.0), like a double rule under a heading followed by a list of posts.

Principles

  • No build step and no runtime dependencies.
  • Works under a strict Content-Security-Policy: no inline scripts or styles.
  • Self-hosted fonts; no CDNs and no tracking.
  • For current Chrome, Edge and Firefox.

What's in it

Part Contents
css/opw.css Design tokens (--pw-*) and components (pw-* classes)
js/opw.js A small module: auto-submitting forms, autocomplete and an image lightbox
fonts/ Anton, self-hosted (SIL Open Font License)
img/ The badges of the Of Pine Wood sites
partials/ Handlebars templates: top bar, footer, breadcrumbs, cards, pager, posts and tags
server/ Node module with the SilverBullet markdown plugins and template helpers

A page loads it like this:

<link rel="stylesheet" href="/res/opw/css/opw.css">
<link rel="stylesheet" href="/res/site.css">
<script type="module" src="/res/opw/js/opw.js"></script>

A site changes the look by overriding the tokens after opw.css. This one only changes the accent:

:root { --pw-accent: #2D553C; }

You can follow along with the feed.


  1. Well the web server itself still needs to be kept up to date, but that's the host's job. ↩︎