Starting a Blog
Table of Contents
Why Start a Blog?
Self Expression - The best ways to get better at something are to A) practice and B) teach. Hopefully, this will be good practice at communicating in writing and solidify things I learn.
Encourage reflection - I admit that I’m a shiny chaser. Maybe that’s a Software Engineer thing, maybe it’s a Millennial thing, maybe something else. Reflection will lead to better choices about staying with something or a better next thing.
Have something to jog memories - There are some personal events going on in my life that remind me that memories make up a lot of who we are. Whether my brain removed a piece of information while compacting or something more serious, there will be a backup of at least part of what I’ve experienced and learned.
Share learnings and ideas - I think the things I work on in my spare time are cool and interesting. Surely, someone else thinks they are, too. Those readers can then bypass the things that I had to hammer out.
Build
The first few steps about Obsidian, Hugo, and some of GitHub were from a tutorial by NetworkChuck. I decided to use GitHub Pages instead of Hostinger. I’ve listed the deviations from the tutorial below.
Tool Installations
I have the habit of using version managers from work, so instead of installing go directly, I installed it from asdf.
asdf plugin add golang https://github.com/asdf-community/asdf-golang.git
asdf install golang 1.23.3
I also added golang 1.23.3
to my $HOME/.tool-versions
file.
I spent way too long debugging that Hugo was out of date, and switched to 0.140.2 with asdf instead of the apt package
asdf plugin add hugo
asdf install hugo 0.140.2
That requires as hugo 0.140.2
in the $HOME/.tool-versions
file as well.
Different Theme Changes
Sass
I needed to install dart-sass for theme. I didn’t want to edit my $PATH
, so I went for the npm route npm install -g sass
. Hugo still complained about sass execute permissions, so I added it chmod +rx <node install>/bin/sass
. That still didn’t work, so I installed Homebrew for Linux to install sass. That finally worked.
brew install sass/sass/sass
PostCSS
I followed follow these instructions to install postCSS. I was hesitant about using npm again, but this tutorial worked.
Add a .gitignore
I don’t like committing generated items, especially if they’re going to be uploaded elsewhere. I’d eventually have to remove public/
for the GitHub Pages submodule.
public/
resources/_gen/
Hosting on GitHub Pages instead of Hostinger
Convert the public folder to a submodule
- Create the github.io repository
- Delete the public folder (It’ll get regenerated)
- Add the GitHub Pages repo as a submodule
git submodule add git@github.com:<username>/<username>.github.io.git public
Create a publish script
#!/bin/bash
rsync -av --delete ~/<obsidian vault>/posts ~/<hugo repo>/content/posts
cd public
git pull
cd ../
python3 images.py # NetworkChucks original script to pull in images
hugo
cd public
git add --all
git commit -m "Automated Commit from Script"
git push origin main
Configure the GitHub Repo
After the first commit, configure the custom domain and TLS under Settings > Pages in GitHub
Learnings
- NPM should not be used as a tool package manager when at all possible. Try to use something like Homebrew or asdf instead.