Creating a Hugo site from scratch
I found the documentation at https://gohugo.io/ to be lacking when it comes to starting a Hugo site from scratch.
There wasn’t much information in the Getting Started section, so I figured I would cover what I do to create a new Hugo site.
Project setup
The first thing I do is navigate to the directory I’m going to create my Hugo project in. For this tutorial, I’ll use a directory called medium
.
mkdir medium && cd medium
Now that I’m in my new directory, I’ll check to see if Hugo is installed. If not, run the installation command.
brew install hugo
hugo version
hugo v0.105.0
Create a new project
Now that Hugo is installed, let’s create a new project.
hugo new site .
This command tells Hugo to create a new site in the current directory.
You can list the directory to see what was created.
ls
archetypes content layouts static
config.toml data public themes
Use a theme
Let’s add a theme. If you don’t know what you want, browse through https://themes.gohugo.io/ to find one close to what you want.
In the following example, I used the whisper theme.
hugo new theme <your_theme>
hugo new theme hugo-whisper-theme
Confirm that themes
directory was added.
ls
archetypes content layouts resources themes
config.toml data public static
Add content
Let’s add new content in a folder called docs
.
hugo new docs/_index.md
Content "content/docs/_index.md" created
Go to your newly created file and add some markdown.
Now enter localhost:1313
in your browser.
Results
You should now see your text in the browser.