Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Create New Blog and Theme

Generate a skeleton site:

$ hugo new site opinionated-blog
$ cd opinionated-blog

The generated file tree should look like:

$ tree
  .
  ├── archetypes
  │   └── default.md
  ├── assets
  ├── content
  ├── data
  ├── hugo.toml
  ├── i18n
  ├── layouts
  ├── static
  └── themes

You could place all your templates in the layout directory, but I think it’s better to generate a new theme in the theme directory. This keeps the content and the style separate and you can version the theme in its own Git repo.

$ hugo new theme opinionated-theme

Hugo will generate a new theme that looks like:

themes
    └── opinionated-theme
        ├── archetypes
        │   └── default.md
        ├── assets
        │   ├── css
        │   │   └── main.css
        │   └── js
        │       └── main.js
        ├── content
        │   ├── _index.md
        │   └── posts
        │       ├── _index.md
        │       ├── post-1.md
        │       ├── post-2.md
        │       └── post-3
        │           ├── bryce-canyon.jpg
        │           └── index.md
        ├── data
        ├── hugo.toml
        ├── i18n
        ├── layouts
        │   ├── _default
        │   │   ├── baseof.html
        │   │   ├── home.html
        │   │   ├── list.html
        │   │   └── single.html
        │   └── partials
        │       ├── footer.html
        │       ├── head
        │       │   ├── css.html
        │       │   └── js.html
        │       ├── header.html
        │       ├── head.html
        │       ├── menu.html
        │       └── terms.html
        ├── LICENSE
        ├── README.md
        ├── static
        │   └── favicon.ico
        └── theme.toml

Open up hugo.toml in your favorite editor. Change the title and and add the theme we created to the configuration:

title = 'Opinionated Blog'
theme = 'opinionated-theme'