
make this blog - part 1
Overview
I wanted to make a blog to share things I find interesting. In particular, I wanted it to be static, lightweight, and scalable.
Helpfully, this is a problem with a simple, comprehensive and documented solution (Wordpress). Less helpfully, I decided to use the opportunity to learn a little more - and if you’re reading this, you probably did too. Maybe you have a more complex use-case than wordpress can provide, maybe you’re interested in using AWS or Astro to make something beautiful. In whatever case, welcome.
Requirements
- The site should be fast, SEO optimized, and secure
- Static site generation is our friend here, with pre-rendered pages.
- Individual blog posts should be built on top of a shared layout so that I can change the design further down the line
- Use a web framework
- Delivery of an MVP should be fast, with the opportunity to ‘lift-and-shift’ to make layout and design changes downstream
- Use a common and well-documented Web framework
- Delivery of the MVP should be simple and well-documented so I can focus my time doing what I want to do
- A well used and documented Web framework
- Markdown, which I already use extensively in my personal notes with Obsidian
- The blog should also play well with other tech I want to use, specifically AWS, and CloudFlare
- Finally, the site, themes and so on should be as cost-efficient as possible within these constraints.
After a little discovery work, there’s a lot of love for a number of Static Site Generators, including Hugo, Jekyll and Astro.
I chose Astro, because of the easy setup, active community and integrations. I took a look at blogs like this , who seemed to have already done a lot of what I wanted to do.
Building a blog
Dependencies
npm
nodejs
This resulted in some minor issues with installing the correct NodeJS version, requiring reinstallation:
sudo apt purge nodejs && \
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash && \
nvm install node
After which it’s time to get started:
npm create astro@latest
npm run astro add tailwind
npm run dev
Note:
npx
(Node Package Execute) is similar tonpm run
, but allows running packages without installing them globally, by fetching the latest package version on-demand. In comparisonnpm run
must have the script defined inscripts
section ofpackage.json
. This meansnpm run
is useful regarding consistency and dependencies, andnpx
is useful where one don’t want to install additional packages, or is trying to reduce wear on that keyboard.
With those commands, a dev environment for Astro will be created on your localhost, accessed at http://localhost:4321
Once comfortable, it’s easy to start a new blog with the built in templates:
npm create astro@latest -- --template blog