(2017, 2018)
$ hugo new site devilghost
$ cd devilghost
$ git init
$ git submodule add https://github.com/…/the-theme.git themes/the-theme
$ echo 'theme = "the-theme"' >> config.toml
$ hugo new posts/my-cool-post.md
$ vim content/posts/my-cool-post.md
$ hugo server -D --verbose
Hugo is a static site generator/blogging platform. It’s written in Go. Hugo support authoring posts in Markdown, and adding TOML, YAML or JSON metadata as frontmatter.
# apt-get install hugo
$ hugo help
Create a site:
$ mkdir -p ~/Documents/hugo
$ cd ~/Documents/hugo
$ hugo new site example
$ tree -a example/
example/
├── archetypes
├── config.toml
├── content
├── data
├── layouts
├── static
└── themes
6 directories, 1 file
archtypes/
holds custom post types that get used by hugo new
for pre-populating frontmatterconfig.toml
sets basic site configurationcontent/
holds user created content; we can create subdirectories here for site sections (e.g. howto, reviews, etc.)data/
includes configuration used during site generationlayouts/
specified how to convert content to static site outputstatic/
holds static content like CSS and JavaScript filesthemes/
layout and templates for content rendering (how does this differ from layouts/
?)$ cd example
$ cat config.toml
baseurl = "http://example.org/"
languageCode = "en-us"
title = "My New Hugo Site"
Create a new post:
$ hugo new my-first-post.md
$ hugo new mysection/my-post.md
$ hugo server --buildDrafts
A Hugo site needs a theme to work, but simply doing hugo new site mysite
will not create a theme.
Either import an existing community theme or create a new custom theme.
$ cd mysite/
$ hugo new theme mytheme
$ tree mysite/themes/mytheme/
mysite/themes/mytheme/
├── archetypes
│ └── default.md
├── layouts
│ ├── 404.html
│ ├── _default
│ │ ├── baseof.html
│ │ ├── list.html
│ │ └── single.html
│ ├── index.html
│ └── partials
│ ├── footer.html
│ ├── header.html
│ └── head.html
├── LICENSE
├── static
│ ├── css
│ └── js
└── theme.toml
7 directories, 11 files
We can create a bare-bones theme like:
$ hugo new theme mytheme
Look in mytheme/layouts/
.
The files index.html
, list.html
, and single.html
are required, but hugo new theme
only creates empty stubs for these.
Until we populate at least these files with some content, Hugo serves blank pages.