Skip to content

The Hugo Workflow Or How To Blog With Hugo

Hugo is a website framework to create static web sites. The sites are fast, secure and work on every server.

BUT!

Static is static. You wont get a nice front- end with a wysiwyg- editor. It’s just plain old markdown, rendered into html. Which leads to some problems if you wanna blog. Or have a webshop…

For the first problem, I found a solution. It’s quite simple if you’re familiar with powershell, but I’m sure you may be able to make something similar in bash. So here’s a little step by step workflow, which I used to blog. But I somehow prefer wordpress. Because of it’s customability with self-written or pre-made plugins.

What you need:

  • A webserver with ssh or ftp
  • Hugo runtime
  • Editor of your choice

How It Works

You write your content like you’re supposed to do and execute a workflow-script.

The Workflow- Script

The basic steps of the workflow are executing hugo and uploading your files.

I even added an additional step. Since my webserver comes with an ssh access and a git client I was able to push-n-pull my website, keeping every version of it into a git repo. There’s an example of how I solved it as featured image or on my github.

(Obviously some parts were removed because of security, like server and git-repo)

1. In the first couple of lines it just creates the website, changes into the public folder and pushes the content to a remote git repo
2. In the part after “git pull over ssh” it checks if your host is already in a session and if not it asks you for the credentials
3. The last part are just some ssh cli commands to change into the webdir of the server and pull the repo

Of course you can simplify this script if you just use ftp, but why make it easier if you can make it more complicated. Well, it’s not really that hard.

What are your hugo- workflows? Write it down in the comments below.

Published inQuickiesWeb

Be First to Comment

Leave a Reply

%d bloggers like this: