I love lots of things about Hugo. The simplicity (it’s just html, no engines required), the speed - it is rapid, a near realtime rendering whilst editing posts, and it’s very flexible. A little quirky in places, but ultimately it spits out a set of html pages so you can get it to look whatever you like.

However, it’s not as accessible as a point and click wordpress site and I tend to sleep several times between posts and I forget things. This post, like many on here is for me and lists the things I now no longer need to remember in order to get a new post published…

  1. Pull down the latest set of changes from the repo - you use 4 different computers so dont assume you have the latest changes and blindly build and publish. This causes pain!

  2. Update the Hugo engine

    brew update && brew upgrade hugo
  1. Launch hugo locally
    hugo server -D --navigateToChanged
  1. Point a browser at hugo: hugo local

  2. Start making changes

    hugo new content "blog/$(date +'%Y%m%d')-MyNewFile.md"
  1. Publish

Get hugo to rebuild all of the files and then launch Transmit which will sync changes up the the webhost.

    hugo
    ./PublishSite.zsh

Markdown stuff

What Description
Headings # title {#anchor-id} (optional)
## sub-title
Code blocks `code goes inbetween`
Italic *italic*
Bold **bold**
Bold and Italic ***bold and italic***
Strikethrough ~~strikethrough~~
Bullets * wang your point in here
Lists 1) list item
Images ![alt text](/images/blog/hugo/hugo-logo.png)
Images { {< hero-image "/images/blog/hugo/hugo-logo.png" >} }
Links [Blog](/blog/20230811-hugo-cheatsheet/#markdown)
Emoji Just copy and paste them in. Emojipedia
🤮 😀 😂 🤠 😅 🙋‍♂️ 🤦‍♂️ 🍆

Tables

| What | Description |
| -----------: | ----------- |
| Code blocks | ``` `code goes inbetween` ``` |

Fancypants code snippet

1
2
3
    { {<highlight csharp "linenos=true">} }
        codez goes here
    { {</highlight>} }

PublishSite.zsh

I have an ssh login to the site which means that I can use rsync to transfer the deltas. I wrap this up in a script that I can run from the terminal (I used to use the Transmit application but this is not as convinient as the shell script).

    #!/usr/bin/env zsh

    # Local directory to sync
    local_dir="/users/marcbeavan/projects/site/public/"

    # Remote SSH username and domain
    remote_user="bobber"
    remote_domain="mydomain.com"

    # Remote directory to sync to
    remote_dir="/path/to/remote/directory/"

    # Rsync command
    rsync -avzh --progress "$local_dir" "${remote_user}@${remote_domain}:${remote_dir}"

the rsync switches…

Switch Description
a Stands for “archive”, syncs recursively and maintains permissions, times, symbolic links, etc.
v “Verbose”, shows the details of the process.
z Enables compression, which is useful for faster transfers.
h “Human-readable”, displays file sizes in a more readable format (e.g., MB, GB).