Automating Hugo Posting
I’ve written a small fish function to automate the creation of a new post on this site.
Fish is the shell I use pretty much everywhere (instead of the default
bash shell on Linux, or
zsh on macOS). It has a great command language and the ability to create functions that become shell commands. The following code is saved as
To create this post I ssh’ed into the server (actually I keep a mosh session always open on most of my computers, including the iPad with a tmux pane dedicated to this purpose) and typed
newpost automated. This fish function creates a new blank markdown file, opens it in my editor, and then will rebuild the site once I finish editing.
Here’s the function…
Thanks to this script, and Hugo, all I need to do to post here is log into the server and type
newpost <postname>. That’s exactly what I’ve been looking for.
By the way, Hugo has a ton of interesting templates. This is Binario. Like it?