Prerequisites
You need to fulfill some prerequisites to configure your machine, before starting the development process of your static site via Hugo.
If youβre using macOS, then Homebrew is the easiest way to install the prerequisites. Check out this guide to install Homebrew on your machine.
Install Hugo
Install Hugo with the following command on your Terminal according to your operating system.
winget install -e --id Hugo.Hugo.Extended
If you successfully installed Hugo, then you can check the version with the following command.
hugo version
brew install hugo
If you successfully installed Hugo, then you can check the version with the following command.
hugo version
Please follow the official documentation to install Hugo on Linux.
If you successfully installed Hugo, then you can check the version with the following command.
hugo version
Or
Go to the official site to Download and Install Hugo Extended.
Install Go
Install Go with the following command on your Terminal according to your operating system.
winget install -e --id GoLang.Go
If you successfully installed Go, then you can check the version with the following command.
go version
brew install go
If you successfully installed Go, then you can check the version with the following command.
go version
Please follow the official documentation to install Go on Linux.
If you successfully installed Go, then you can check the version with the following command.
go version
Or
Go to the official site to Download and Install Go.
Install Nodejs
Install Nodejs with the following command on your Terminal according to your operating system.
winget install -e --id OpenJS.NodeJS.LTS
If you successfully installed Nodejs, then you can check the version with the following command.
node -v
brew install node@18
If you successfully installed Nodejs, then you can check the version with the following command.
node -v
Please follow the official documentation to install Nodejs on Linux.
If you successfully installed Nodejs, then you can check the version with the following command.
node -v
Or
Go to the official site to Download and Install Nodejs.
After installing all the prerequisites, maybe you need to restart your machine to take effect.
Setup Your Project
Unzip the downloaded file, and you will find the fortify-hugo folder inside the themes directory. This folder contains your main theme, which you will be working with.
π fortify-hugo/ (Unzipped Folder)
|
βββ π themes/
| |
| βββ π fortify-hugo/ (Main Theme)
|
βββ π changelog.html
βββ π documentation.html
βββ π license.html
You can set up your project in two ways. (Follow any one of them)
Gethugothemes Exclusive Way (Recommended)
Open the
fortify-hugo
(Main Theme) using your favorite code editor. VS Code is recommended.Open the VS Code terminal (Ctrl+`) and execute the following command to set up your project:
npm run project-setup
Traditional Way
If you want to set up your project in the traditional way, then follow the link: Traditional Project Setup
Run Your Project Locally
Open vscode terminal (ctrl+`) and run the following command to install all dependencies.
npm install
Run the following command to start the development server.
npm run dev
Now, you get a generated URL and open it in your browser. The default URL looks like this localhost:1313.
If your website doesn’t serve on your localhost, then check the theme
name is correct in your hugo.toml
file. Then run npm run dev
command again.
Build Your Project
After completing your development process, you can build your project for production. You can build your project with the following command.
npm run build