Creating a Hugo Static Site
How to create a static website using the Hugo static website generator. The instructions are geared towards Windows since that is the operating system I use the most.
Install Hugo on Windows
- Create the folder path: C:\Hugo\bin
- Download the latest extended Hugo zip file since some themes require it. e.g. hugo_extended_
_Windows-64bit.zip - Extract the zip file contents to the C:\Hugo\bin folder. The Hugo executable path is C:\Hugo\bin\hugo.exe.
- Add the folder path C:\Hugo\bin\ to your system environment variables.
- Search for "env" in the Windows search bar and select Edit the System environment variables
- Enter an administrator password if prompted.
- Click on the Environment Variables button.
- In the System variables section click on path entry
- Click on New and add the path C:\Hugo\bin
- To test the installation:
- Open a new command prompt window (search for cmd and select Command Prompt)
- Type hugo help and press Enter.
- You should see usage documentation starting with:
Hugo is the main command, used to build your Hugo site.
Hugo is a Fast and Flexible Static Site Generator built with love by spf13 and friends in Go.
Hugo is a Fast and Flexible Static Site Generator built with love by spf13 and friends in Go.
Install a Hugo theme
- Create a new folder for your website files. I use a different drive or partition from my operating system (e.g. D:\Data\MyBlogSite) so that I can back up my website easily.
- Initialize a new website:
- Open a new command prompt window.
- Change directory to the website folder (e.g. cd D:\Data\MyBlogSite).
- Type "hugo new site" (no quotes), and press enter.
- Select and click on a Hugo theme to navigate to the theme's GitHub page.
- Click on the Download ZIP button:
- Extract the zip file contents to your MyBlogSite folder.
- Follow the instructions on the theme's GitHub page for how to configure the theme.
- Add a batch file in your MyBlogSite folder to start the Hugo server:
- Create a new text file in your MyBlogSite folder and add the text hugo server.
- Save the file and rename it to hugo_server.bat.
- Double-click the file to start the Hugo server.
- Open a browser window and navigate to http://localhost:1313/
- You should now see the home page of your new static website!