Check Hugo version
In a terminal, enter the command:
hugo version
If Hugo is installed you should see a message indicating the Hugo version number.
Create a new website
In a terminal pointed to the directory where you want Hugo project files to reside, enter the command:
hugo new site my-hugo-website
NOTE: Replace my-hugo-website with the site name you want.
You should see a message beginning with
Congratulations! Your new Hugo site is created in…
Create a new project file
In a terminal pointed to the directory where your Hugo project files reside, enter the command:
hugo new /folder/my-file.md
Replace my-file.md with the file name you want.
Replace folder with the relative path to the directory where you want your new file to reside.
Start the Hugo server to see your website
In a terminal type the command:
hugo server
Open a web browser to http://localhost:1313/ to see your new site.
Leave the server running to see changes applied as you make them.
Press CTRL + C
to stop the server.
To see draft pages
hugo server -D
Include the -D
flag to see pages marked as drafts. Leave the flag off to see only pages marked as final.
To see pages marked for future publication
hugo server -F
Include the -F
flag to see pages marked with a publishdate in the future.
To see additional options
See the Hugo documentation for many more server options.
Build a website from your project files
In a terminal pointed to the directory where your Hugo project files reside, enter the command:
hugo
The generated files will be output to the /project-folder/public/
folder, where project-folder is the main directory of your project.