Creating Your Site

Hugo has a built-in command that generates a website project for you; this includes all of the files and directories you need to get started.

Execute the following command to tell Hugo to create a new site named portfolio:

 $ ​​hugo​​ ​​new​​ ​​site​​ ​​portfolio

This creates the portfolio directory, with the following files and directories within:

 portfolio/
 ├── archetypes
 │   └── default.md
 ├── config.toml
 ├── content
 ├── data
 ├── layouts
 ├── static
 └── themes

Each of these directories has a specific purpose:

In your terminal, switch to the newly created portfolio directory:

 $ ​​cd​​ ​​portfolio

Take a look at the site’s configuration file. Open the config.toml file in your text editor. You’ll see the following text:

 baseURL = ​"http://example.org/"
 languageCode = ​"en-us"
 title = ​"My New Hugo Site"

This file is written in TOML,[11] a configuration format designed to be easy to read and modify. The default configuration file only has a handful of data, but you’ll add more as you build out your site.

Hugo’s internal functions use the baseURL value to build absolute URLs. If you have a domain name for your site, you should change this value to reflect that domain. In this book, you’ll use relative URLs, so you can leave this value alone until you’re ready to deploy your site to production.

The title value is where you’ll store the site’s title. You’ll use this value in your layouts, so change it from its default value:

kicking_tires/portfolio/config.toml
 baseURL = ​"http://example.org/"
 languageCode = ​"en-us"
»title = ​"Brian's Portfolio"

Save the file and exit the editor. You’re ready to start working on the site itself.