David Härer / Cheatsheets

Hugo Cheatsheet



What is Hugo?

Hugo is a static site generator (SSG) written in Go (i.e. it’s good).

Which theme do I recommend for documentations?

The best Hugo theme for documentation I know is Docsy. It is maintained by Google.

How do I redirect a page to an external URL?

To redirect to external links in Hugo, you can use the <meta http-equiv="refresh" ... /> tag. Add the following snippet in the <head> section of _default/baseof.html of your template:

{{ if isset .Params "redirect" }}
    <meta http-equiv="refresh" content="0; url='{{ .Params.redirect }}'"/>
{{ end -}}

In the frontmatter of a page, you can now set redirect to the external URL.

---
title: "Example"
redirect: https://example.com
---

Sources