brew install hugo
brew upgrade hugo
Using the snap package seems easy, since the version in apt
is likely outdated, and there doesn't seem to be a trusted PPA:
snap install hugo --channel=extended
hugo version
Hugo Static Site Generator v0.61.0/extended linux/amd64 BuildDate: 2012-12-11T13:56:49Z
hugo new site the-best-static-website
Congratulations! Your new Hugo site is created in /Users/juan/websites/the-best-static-website.
Just a few more steps and you're ready to go:
1. Download a theme into the same-named folder.
Choose a theme from https://themes.gohugo.io/, or
create your own with the "hugo new theme " command.
2. Perhaps you want to add some content. You can add single files
with "hugo new /.".
3. Start the built-in live server via "hugo server".
Visit https://gohugo.io/ for quickstart guide and full documentation.
Enter the newly created project directory, and pull in a theme.
cd the-best-static-website
git init
git submodule add https://github.com/budparr/gohugo-theme-ananke.git themes/ananke
hugo new posts/my-first-post.md
hugo server -D
+++
categories = ["Development"]
project_url = "https://github.com/gohugoio/hugo"
series = ["Websites are the Best"]
slug = "websites-r-best"
tags = ["Websites", "WWW"]
title = "Websites: The Definitive Guide"
+++
hugo new site . # create new site in current dir
hugo new post/welcome.md # create a new post
hugo server --watch [--buildDrafts] # Run in server live-reload mode
hugo # Generate a public directory using default theme
hugo --theme=my-theme # ...or with a specific theme
hugo undraft post/welcome.md # Un-draft a post (sets draft = "false" in front matter)
The data folder is where you can store additional data for Hugo to use when generating your site.
The .Hugo.Environment
variable can be used to check if the current context is 'development' or 'production':
{{ ne .Hugo.Environment "development" }}
Sometimes it's nice to be able to grab data from the front matter and/or params of a different page; do so with the .GetPage
function. For example:
{{ with .Site.GetPage "/aboutus" }}
{{/* front matter title of the '/aboutus' page */}}
{{ .Title }}
{{/* custom front matter params from the '/aboutus' page */}}
{{ .Params.manifesto_copy }}
{{ end }}
{ partial "testPartial" (dict "test" "testValue" dict "context" . "pages" $.Site.Pages) }}
Then you'll be able to access these variables in the partial as: .test
, .
(the parent context), and .pages
.
Yes, via taxonomies: https://gohugo.io/content-management/taxonomies/.
This gihub repo: https://github.com/guayom/hugo-taxonomies has some great clarifying info on taxonomies as a supplement to the Hugo docs.