- Windows:
scoop install make yq hugo-extended
- Debian:
sudo apt install make yq hugo
- Arch:
yay -S make yq hugo
- MacOS:
brew install make yq hugo
# Run the linters
make lint
# Download ionicons
make svg
# Launch the debug server
make run
# Build the site for production
make build
Use Material Theme Builder to generate CSS in assets/scss/vendors/material-theme
sequenceDiagram
Writer ->>+ Strapi: CRUD
Strapi ->>+ Webhook: Send webhooks
Webhook ->>+ Site: Write or delete YAML/MD files
Webhook ->>+ Site: Build site
Webhook ->>+ Git: git push
Hugo is a fast and modern static site generator written in Go, and designed to make website creation fun again. 1
Why Hugo? 2
- Static site, extremely fast & secure
- Can be hosted anywhere
- Run without the need for a database or dependencies runtimes
- Extremely fast build times (< 1 ms per page)
- Fun
Directory structure 3
├── archetypes
├── config.toml
├── content
├── data
├── layouts
├── static
└── themes
layouts
: stores templates in the form of .html
files.
├── layouts
├── partials
├── shortcodes
├── index.html
├── 404.html
layouts/index.html
— the index page templatelayouts/404.html
— the 404 page template
Partials are smaller, context-aware components in your list and page templates that can be used economically to keep your templating DRY. 4
layouts/partials/[article | document | ...]/*.html
— components are used for a the specific section.layouts/partials/shared/*.html
— components are used in many sectionslayouts/partials/*.html
— components are used in the global templates
The site use the config.yaml
as the Hugo config file. 5
Hugo uses the content
directory for building pages, each directory is a section.
assets/scss/main.scss
— used for all pagesassets/scss/<section>.scss
— load for thatsection
only if it existsassets/js/main.js
— used for all pagesassets/js/<section>.js
— used for thatsection
only if it exists
For example, for overwrite the home page:
- Write your SCSS in
assets/scss/sections/home/*.scss
- Import them into
assets/scss/home.scss
- Write your JS code in
assets/js/sections/home/*.js
- Import them into
assets/js/home.js
Hugo uses Go’s html/template
and text/template
libraries as the basis for the templating. 6
{{ printf "%#v" . }}
{{ printf "%#v" $.Site }}
{{ printf "%#v" .Permalink }}
{{ range .Pages }}
{{/* The context, ".", is now each one of the pages as it goes through the loop */}}
{{ printf "%#v" . }}
{{ end }}
You can use Go templates’ printf function to debug your Hugo templates. These snippets provide a quick and easy visualization of the variables available to you in different contexts. 7