Hugo is awesome
Wysiwyg#
For a DIY girl like me, Hugo is awesome. Hugo is a static website generator that gives you complete control over its output — right from the command line. What more could a girl wish for?
Even better, you can use your favorite text editor to write new content or tweak your theme. While I love the command line, I do understand the appeal of wysiwyg: it’s nice to be able see what your content will look before publishing it online. But do you really need a full-blown content management system with all the bells and whistles for that? Nope, actually you don’t. Hugo can help you out just as easily!
My workflow#
So what does my workflow look like? In a nutshell: I create some new content on my laptop, check out how it renders in my browser locally, and when satisfied, push it to my server — which automaticaly deploys it online.
Preferably, I write in Emacs, typing away on my laptop sitting somewhere cozy, with a cup of coffee within reach. On my laptop, I have a local clone of my blog. The main git repository of my blog lives online with Forgejo on my private server, which also serves my blog to the world.
Note to self: write a blog post about magically deploying a static website with Hugo, Forgejo and webhooks.
Before I start writing, I open up a terminal window, jump into the local copy of my blog’s repository and fire up the Hugo development server:
cd ~/projects/blog.annx.nl
hugo server --buildDrafts --navigateToChangedThe Hugo embedded web server watches my files for changes and renders new content in real time. To see what’s happening, I can point my browser to http://localhost:1313.
The buildDrafts option makes Hugo render draft posts as well. And even better: navigateToChanged redirects my browser instantly to my last edit. Babes, that’s so nifty!
In another terminal session I kindly ask Hugo to add some new content and start writing:
hugo new content posts/my-new-post.md
emacs content/posts/my-new-post.mdEvery time I save my changes, the Hugo embedded server renders the new content on the fly, so I can immediatly see what my writings looks like in my browser. Wysiwyg enough for me!
Get it out there#
When I’m satisfied and done writing, I commit and push my edits to the main repository:
git add content/posts/my-new-post.md
git commit -m "Added my new post"
git pushOn my web server Forgejo then automagically triggers Hugo to rebuild my blog and publish it online. It really is that simple.
Last note to self: don’t forget about
draft = truein the front matter of my new post :P
If you’re curious, you can find the repository of this blog here: git.annx.nl.