Hugo cheat sheet

Create new page #

I’m using the Hugo Book Theme, which means it will render the content of the content in the content/docs folder as a book.

So the creation of a new page go as such :

hugo new content content/docs/my-new-page.md

Serve locally #

Simply use hugo serve --disableFastRender. The disableFastRender option is there to ensure proper site construction, when you add page, for example.

Publish website #

I’m using rclone, which is set with a SFTP remote named docs.kntc.be. Enter the following commands :

hugo --gc --minify
rclone sync --interactive public/ docs.kntc.be:

The --interactive can be omitted if you simply want to push to prod and erase everything already present. So, as I’m copy-pasting these commands, this becomes :

rclone sync public/ docs.kntc.be:

Syntax highlighting #

For specific langages, such as YAML, I use syntax highlighting and the emacs style.

Thus, for YAML the header is ```yml {style=emacs}. To highligh specific lines, add hl_lines=[2,"4-7"] between the braces, and to add line numbering linenos=inline.

Here’s the list of supported langages - note, for plaintext you can use either text or ucode.