Create a New Hugo Project

You’ve got your great new idea! Now how to get started? If you’re using Hugo as the tool to build your website then this post should be for you.

We’ll be looking at how to create a new basic project and the first few tasks on a clean new site.

You’ll need Hugo installed first, if you don’t then take a look at our guide on installing it.

1. To Begin

Using the terminal or command prompt (what ever you decide to call it!), navigate to the directory where you keep your projects (I keep mine in ~/www/). Then run the command below, replacing myproject with what you are going to call your project.

hugo new site myproject

new hugo project in terminal

2. Setup

You have your new project created now. But if we try and run it with this:

cd myproject && hugo serve

You’ll get this error:

WARN 2021/04/10 16:43:32 found no layout file for "HTML" for kind "home": You should create a template file which matches Hugo Layouts Lookup Rules for this combination.

:( But it’s no problem, it’s just missing a theme.

We’ll need to get a theme setup, you can find many examples on the theme store. In our example, we’re going to use Anatole.

View Themes View The Anatole Theme

To install our theme:

# Optional step if your new project is not a git repo already
git init
git submodule add themes/anatole

Replace our config file, with the theme’s example (to help us know all the settings/options):

cp themes/anatole/exampleSite/config.toml config.toml

Now, if we try:

hugo serve

… and click the url in the output (a localhost address). We should be greeted by something like this:

new hugo project in terminal

There’s plenty more to be done in setting up a site, but those are the basics of creating a new project and getting it to run. Good luck!