Rewriting this site using Astro

Some details & reasoning for why this was helpful
3 min read

As long time readers might be aware, for the almost 10 years this site has been in operation I’ve been using a version of Jekyll. This used to be hosted on Github Pages, but I moved to a combination of AWS’ S3+CloudFront in mid 2017. In 2021, I introduced a 3d-printing section, and since then various other pages like the blog changelog, recently updated posts

Since I introduced the 3d-printing section, things have been not exactly trivial anymore to build. As posted in my post about my publishing workflow, I already had a set of scripts I run to optimize things. The 3D printing section requires an additional set of scripts. One of which I use to generate images of each .stl file I have. This’ll probably stick around for quite a while. I had a bunch of scripts to generate some of the dynamic pages these use (in retrospect, I might’ve been able to hack it into jekyll’s blog system using page tags, but for some reason I didn’t go that route)

Why I moved to Astro

To make some of these more dynamic sections of the site easier to work on and develop, I spent some time rewriting the core pages of the site to use Astro. Pages like the changelog are much easier to implement, without writing a bunch of ruby (a language I don’t use very often!)

Multiple types of content

I can split out my blog posts and 3d printing content, which is kind of nice. I don’t need to co mingle them, and can use a data collection for the metadata about each post. In Jekyll, I essentially did this within the data/ directory, then had to do a bunch of hacks on top of it. With Astro, I can use the same Astro CMS getCollection() and getEntryBySlug() calls to list and retrieve content.

React Templates, but the site is still actually static

Some other site generators I’d tried in the past ended up doing their rendering on the client side using a js bundle. For this site, I do not want that, so using anything that doesn’t actually output mostly static HTML is a non-starter. Astro fits the bill here, and it has a neat way of handling dynamic pages via getStaticPaths() so that it can render things statically.

What I’d like to see in Astro

Better Sitemap Control

Right now, Astro has pretty limited control over sitemaps (https://docs.astro.build/en/guides/integrations-guide/sitemap/#filter). You can filter out things, but this requires you to manually add the permalinks for posts you want to remove from the listing, etc.

I have a handful of unlisted posts that I don’t want to publish yet, so those are unlisted and are excluded from RSS feeds / page listings based on an unlisted front-matter flag. I’d love to be able to somehow grab that info within the sitemap filter() function so I can make those decisions programmatically. I may end up re-implementing the sitemap myself and rendering it similar to how Astro does RSS feeds & how I did it for the older versions of this site.

Subscribe to my Newsletter

Like this post? Subscribe to get notified for future posts like this.

Change Log

  • 3/5/2024 - Initial Revision

Found a typo or technical problem? file an issue!