The home page of this blog looks a little like a periodic table. The site identity, the menu, and the articles all have a place in the same grid. I like what repetition does here. Each new article has somewhere to go, and the next one can follow the same rule. It’s a small way to put some order into my own chaos.
I’d also always wanted a blog with an editorial feel. I like typefaces, and I wanted them to do some of the work. The grid gives the home page its rhythm. On an article page, the typography carries that rhythm through the title, the paragraphs, and the captions. The site uses Newsreader and Source Sans 3, a serif and a sans serif with different jobs.
Once I knew what I wanted the blog to feel like, I had a more practical question. How much work should it take to change a sentence and get it in front of a reader?
A post starts as a file
Each article is a Markdown file in the Git repository. The headline, date, and tags live at the top of the file. The text follows. I can edit it in a text editor or use Pages CMS, which gives me forms for posts, pages, and navigation. Either way, a change to an article ends up in the same Markdown file, where Git can show me exactly what changed.
Astro turns those files into pages at build time. I can read a draft in local development, and the production build leaves it out. Astro also generates the tag archives from the visible posts. If I change an article’s tags, the next build updates the affected archives along with the article.
That’s the part of the setup I expect to appreciate most on an ordinary day. If I spot a typo or rethink a title, I know which file to open and what will pick up the change.
Search starts after the pages are built
Once Astro has generated the HTML, Pagefind reads the output and builds the search index. It works from the same pages the reader will see. A draft that stays out of the production build also stays out of the search index.
The browser loads the search module when someone first types a query. A reader who opens an article and spends the next five minutes reading it has no reason to download the search code. The page can already be served as HTML, and the search can wait until it’s needed.
The fonts are a deliberate part of what the browser does download. They shape every paragraph on the page. I like that the architecture lets me make that choice separately from when to load an interactive feature like search.
From the build to the reader
At the time of writing, the first deploy was still ahead. I’d prepared a GitHub Actions workflow to build the site and its search index when a change lands on main. The workflow uploads the files to S3, with assets going up before the HTML that refers to them. Once the upload succeeds, it asks CloudFront to invalidate its cache so the next request for an updated page can fetch the new copy.
S3 is where the files will live. CloudFront can serve a cached copy from a location closer to the reader, so a request for an article can be answered without going back to the bucket. There’s a small detail in that setup that I like. Astro writes the About page as about/index.html, while the link says /about/. A CloudFront Function translates the public URL into the path of the file S3 holds.
I also want the public site and the publishing workflow to have different permissions. The plan is to keep the bucket private and give CloudFront permission to read it through Origin Access Control. GitHub Actions will use OpenID Connect to obtain temporary AWS credentials for uploading the build and invalidating the distribution. AWS WAF will sit at CloudFront, where it can apply rules to incoming web requests. The static build keeps that setup smaller because there’s no application server generating articles on every visit.
The first test I care about is a small one. I want to correct a sentence in Markdown, let the workflow run, and see the corrected sentence at the same URL. Then I want to find it through search. That’s when I’ll know whether the blog is as easy to live with as I wanted it to be.