In Hugo v0.118.0 we improved the skeletons generated by the “hugo new site” and “hugo new theme” commands. Specifically, the “hugo new theme” command now creates a functional theme with sample content.
The theme is minimal, demonstrating basic features such as:
- Directory structure
- Content structure
- Page bundles
- Date localization
- Menus
- Taxonomies
- Partial templates (including cached partials)
- CSS inclusion
- JavaScript inclusion
- Static files
The new skeleton structure is useful for:
- Creating a new theme from a functional, minimally opinionated example
- Learning how Hugo works
- Testing
Although we may tweak the theme skeleton in the future, we intentionally excluded examples of intermediate and advanced features. The use cases described above require a simple, minimally opinionated starting point. Or to put it another way, please don’t submit pull requests to add examples of image processing, render hooks, etc.
To create a functional site and theme:
hugo new site mysite
cd mysite
hugo new theme mytheme
echo "theme = 'mytheme'" >> hugo.toml
hugo server
To create a functional site without a theme:
hugo new theme mysite --themesDir .
cd mysite
hugo server
If you need to create disposable test sites frequently, you can create an alias to do so. An alias is a shortcut that allows you to run a command by typing a shorter name. To create an alias for creating a new site and opening it in Visual Studio Code:
alias htest='hugo new theme testing --themesDir . && cd testing && code .'