NOTE: tutorial source is avilable: git clone https://github.com/bubbleuptoppop/mysite
In this example the project name will be mysite. To give your project a different name, replace mysite with a desired name.
$ hugo new site mysite
You should get something like:
Congratulations! Your new Hugo site is created in /Users/myhome/mysite.
Just a few more steps and you're ready to go:
1. Download a theme into the same-named folder.
Choose a theme from https://themes.gohugo.io/ or
create your own with the "hugo new theme <THEMENAME>" command.
2. Perhaps you want to add some content. You can add single files
with "hugo new <SECTIONNAME>/<FILENAME>.<FORMAT>".
3. Start the built-in live server via "hugo server".
Visit https://gohugo.io/ for quickstart guide and full documentation.
Go to the project directory
cd mysite
Add Theme
Choose theme from hugo theme library at themes.gohugo.io/.
For this example, lets choose https://themes.gohugo.io/hugo-split-theme/
There are theme specific directions for each theme on the theme page, follow theme instructions to start quickly. |
In terminal:
$ cd themes (1)
$ git clone https://github.com/escalate/hugo-split-theme.git (2)
$ cd .. (3)
1 | Go to the themes directory |
2 | Clone the theme |
3 | Change back to the project directory |
Configure the theme.
The theme instructions recommends copying the configuration files from the example site. Follow the link to the example site, click on config.toml, to see the contents of the file. Click on the Raw button.
Select all text by dragging the mouse over it, or in Windows use Control-a
or in Mac OS use Command-a, then copy text. Use any text editor, open up
the mysite/config.toml
, delete all the text from it and paste the copied
text in there, save the file.
Start Server
Make sure you are in the project root directory, which is mysite
, then go to
terminal and enter:
$ hugo server -D
- server
instructs hugo to run the server.
- -D
instructs the server to render draft documents
-D instructs hugo to render the drafts. The drafts are the posts
where there is this line in the header: draft: true |
The output should look like this:
Start building sites …
| EN
-------------------+-----
Pages | 1
Paginator pages | 0
Non-page files | 0
Static files | 8
Processed images | 0
Aliases | 0
Sitemaps | 0
Cleaned | 0
Built in 16 ms
Watching for changes in /Users/myhome/mysite/{archetypes,content,data,layouts,static,themes}
Watching for config changes in /Users/myhome/mysite/config.toml
Environment: "development"
Serving pages from memory
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at //localhost:1313/ (bind address 127.0.0.1)(1)
Press Ctrl+C to stop
1 | The server is at //localhost:1313/ where localhost is the url and
1313 is the port on which the server is running. |
Start a browser and enter localhost:1313
, replacing 1313
with whatever port
Hugo specified.
The site should look like the theme demo site.
CONGRATULATIONS: The site is running.