Added post Hugo workflow
This commit is contained in:
56
content/posts/hugo-workflow.md
Normal file
56
content/posts/hugo-workflow.md
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
+++
|
||||||
|
title = "The appeal of wysiwyg"
|
||||||
|
author = ["Anne"]
|
||||||
|
date = 2025-03-16T00:00:00+01:00
|
||||||
|
lastmod = 2025-10-31T23:20:49+01:00
|
||||||
|
draft = false
|
||||||
|
+++
|
||||||
|
|
||||||
|
For a DIY kind of girl like me, [Hugo](<https://gohugo.io>) is the best. Hugo is a static website generator that gives you complete control of its output --- right from the command line. What more could a girl wish for?
|
||||||
|
|
||||||
|
<!--more-->
|
||||||
|
|
||||||
|
Even better, you can use your [favorite text editor](<https://www.gnu.org/software/emacs/>) 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 how 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 {#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 locally in my browser, and when I'm satisfied, push it to [Gitea](<https://about.gitea.com/>) --- 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 repo clone of my blog. The git repository lives on Gitea on my private server, which also serves my blog to the world.
|
||||||
|
|
||||||
|
Before I start writing, I `cd` into the root of my local copy of my blog's repository and fire up the Hugo web server:
|
||||||
|
|
||||||
|
```sh { linenos=false }
|
||||||
|
hugo server --buildDrafts --navigateToChanged
|
||||||
|
```
|
||||||
|
|
||||||
|
The [Hugo embedded web server](<https://gohugo.io/commands/hugo_server/>) watches your files for changes and renders new content in real time. To see what's happening, you can point your browser to `http://localhost:1313`.
|
||||||
|
|
||||||
|
The `buildDrafts` option makes Hugo render draft posts as well. And even better: `navigateToChanged` redirects your browser instantly to your last edit. Babes, that's so nifty!
|
||||||
|
|
||||||
|
Then I kindly ask Hugo to add some new content and start writing:
|
||||||
|
|
||||||
|
```sh { linenos=false }
|
||||||
|
hugo new content posts/my-new-post.md
|
||||||
|
emacs content/posts/my-new-post.md
|
||||||
|
```
|
||||||
|
|
||||||
|
Every time I save my changes in Emacs, ox-hugo exports the org files to markdown files for Hugo. The Hugo server then renders the new content, so I can immediatly see what my writings look like in my browser. Wysiwyg enough for me!
|
||||||
|
|
||||||
|
|
||||||
|
## Get it out there {#get-it-out-there}
|
||||||
|
|
||||||
|
When I'm done writing, I commit and push my edits to the repository in Gitea:
|
||||||
|
|
||||||
|
```sh { linenos=false }
|
||||||
|
git add content/posts/my-new-post.md
|
||||||
|
git commit -m "Added my new post"
|
||||||
|
git push
|
||||||
|
```
|
||||||
|
|
||||||
|
Gitea then automagically gets Hugo to rebuild my blog and publish it online. It really is that simple.
|
||||||
|
|
||||||
|
Note to self: don't forget about `draft = true` in the [front matter](<https://gohugo.io/content-management/front-matter/#draft>) of my new post :P
|
||||||
|
|
||||||
|
If you are curious, you can find the source code of this blog here: <https://git.minded.net/anne/blog.minded.net>.
|
||||||
Reference in New Issue
Block a user