Blog platform setup

Posted on Mon 14 August 2023 in Website

So, I've recently been prompted into putting up some sort of content... albeit the prompt was more for a YouTube channel but beggars can't be choosers and it's not like I plan to point those people here anyway.

Main point of this venture is to have a place to put my thoughts, preferably with the ability to easily search through the content... knowledge showcase for potential employers (hint hint) is also enticing. It might also be nice if someone happens across it and finds it useful, who knows.

At any rate, I don't really want to have a server running all the time, been there, done that. It used to be a small Raspberry Pi 3B+ running some containerised services for the home; caching DNS/AdBlock, Samba share and databases to play around. Nothing that should overwhelm its limited memory anyhow.

Not that it was the only problem with the board... slow Ethernet due to being an adapter over USB 2.0 bus, external storage over that same bus and internal MicroSD card with its flaky nature. I've had quite a few hardware revisions since but that will probably be a topic for another post.

Local hosting only possible (or rather ever so slightly not NOT recommended... Dynamic DNS or uptime reliability issues) because of insisting on having a static IP address with every internet connection, usually also ends up being some business internet offering... side note, they sometimes end up much cheaper for the same or much higher speeds.

Now then, that leaves me a few options, again, I don't really want to pay for something so low-traffic, I doubt anyone ever does regardless... serverless or free cloud hosting. Given my résumé is hosted on GitHub Pages... I'll take that but I could still go with AWS Lambda (plus infrastructure) if dynamic content is ever needed.

That does give me my parameters... static site, free hosting, GitHub Pages. Next up, I don't really want to write a customized solution, and I definitely don't want to constantly copy and paste for new articles... static site generator it must be. Need to choose a solution, I've had the opportunity to use Jekyll before... it ended up a bit too clunky and extending it without knowing Ruby was a bit of a pain. Something with my language of choice them, Python. Quick search engine query later, some GitHub star popularity sorting and my choice is Pelican.

Pelican appears to have an easy quickstart... good, I honestly don't have the patience if something is too complicated to start... I'd probably just move on to find another option. Although, they really could update their documentation, or frequently asked questions for how to configure the generator output to appear within a subdirectory instead of the root of the website. Clarification on what the quickstart URL prefix options actually end up doing would be nice too.

Plenty of good to say about the project though, easy Google Analytics integration (résumé has it so this will too), programmable configuration file, live development server, an option for Markdown article source files, generates its own build and publish automation, Atom and RSS feeds (at a glance) etc. One can just keep on going, suffice to say, very well supported and documented project.

I've managed to set it up in a subdirectory by tossing the sources in an 'articles' directory and having it output to the 'blog' directory. Set the SITEURL to 'blog' and it'll do relative links somehow, it was all a bit of trial and error really. Google Analytics parameter was filled out in the 'publishconf.py' file... mine starts with 'G-...' but the examples I saw online had 'UA-...' so I'm not sure if that's a new thing... I'll find out if it actually works once I push it up to GitHub Pages.

Choose a theme because I'm not that creative quite yet, again, lovely point for Pelican... community themes galore and so easy to change, one constant to update.

Naturally, I did all the useful developer experience thingies; virtual environment for Python, gitignore that and the 'pycache'... more pending... I'm sure.

Finally, need to prevent some mistakes, for example, not regenerating content after a new article or change. To that end, I'll be using GitHub Actions deployment for GitHub Pages... That action is essentially Python setup and Pelican publishing. This means the 'blog' output directory is not in the repository, added to '.gitignore' for local testing. It also has an exclusion for the 'articles' directory.