Today’s post is about my most recent experience using the Hugo static site generator. Every so often I get a bee in my bonnet about setting up a blog from scratch, on my own machine, and I figured it might be fun to go through the process from A to Z.
Here’s an overview of the setup:
- I used Hugo to install a website in a folder on my computer using the Quick Start instructions
- I chose the original Tufte theme for Hugo, setting it up as a submodule per the instructions in quickstart.
- I turned my website folder into a git repository with git init, and then pushed the repo up to github.
- In OSS (a free code editor) I fiddled with the website on my local machine until it was set up the way I wanted. The theme is great, so mostly I was modifying the configuration file.
- I connected that repository to Netlify (they offer free hosting for small blogs) and pointed the DNS records for my domain to it.
That’s when I ran into my first big snafu. I wanted to make a couple changes to the theme itself, but I couldn’t, because I’d installed the official Tufte theme as a submodule. Oops! I can’t go messing with the official source of that code. P helped me remove the submodule for Tufte. Then we FORKED that submodule (made me a copy) and installed the copy as a submodule.
Whew! Git-fu can get a bit complicated.
Literary.Monster is up and running! Granted, it’s mostly full of sample posts and it lacks an RSS feed, but it’s not too bad for a few hours of work.
Hugo on iOS
The thing holding me back from building my own Hugo site was the lack of mobile functionality. I’m not always at my desk, and I like being able to dash off a quick blog post from my phone. A friend shared a bit of advice that helped: There’s a github client for iOS called Working Copy that helps you push posts to github right from iOS. Neat!
So here’s how blogging from my phone works:
- I open up an iOS text editor and write my post.
- I make sure the post has the correct Hugo metadata up top. Things like the post name, date, and any tags I’m using.
- Next, I use the “share” button to share the post I’ve just written to Working Copy.
- I select the correct folder in my repo, click commit, and then push.
Wham bam! Github gets my latest post. Netlify notices and rebuilds my site. Within seconds, my new post is live. With some templates for the metadata, it should be pretty seamless.
I’m not a programmer, so I always feel extra proud when I manage to do a new techie thing. This qualifies! I don’t know if I’ll keep the hobby blog or not, but I’ll play around with it for a while, see if I can add that RSS feed, and enjoy the perks of learning something new. 😃