Based on last commit in Git.
4.2 KiB
author | lastmod | date | linktitle | toc | menu | next | prev | title | weight | ||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Michael Henderson | 2015-12-23 | 2015-03-30 | Installing on Windows | true |
|
/tutorials/mathjax | /tutorials/installing-on-mac | Installing on Windows | 10 |
Installing Hugo on Windows
This tutorial aims to be a complete guide to installing Hugo on your Windows computer.
Assumptions
- You know how to open a command prompt window.
- You're running a 64-bit version of Windows.
- Your website is
example.com
. - You will use
D:\Hugo\Sites
as the starting point for your site. - You will use
D:\Hugo\bin
to store executable files.
Setup Your Directories
You will need a place to store the Hugo executable, your content (the files that you build), and the generated files (the HTML that Hugo builds for you).
- Open up Windows Explorer.
- Create a new folder,
D:\Hugo
. - Create a new folder,
D:\Hugo\bin
. - Create a new folder,
D:\Hugo\Sites
.
Download the pre-built Hugo executable for Windows
One advantage of building Hugo in go is that there is just a single binary file to use. You don't need to run an installer to use it. Instead, you need to copy the binary to your hard drive. I'm assuming that you'll put it in D:\Hugo\bin
. If you chose to place it somewhere else, you'll need to substitute that path in the commands.
- Open https://github.com/spf13/hugo/releases in your browser.
- The current version is hugo_0.15_windows_amd64.zip.
- Download that ZIP file and save it in your
D:\Hugo\bin
folder. - Find that ZIP file in Windows Explorer and extract all the files from it.
- You should see a
hugo_0.13_windows_amd64.exe
file. - Rename that file to
hugo.exe
. - Verify that the
hugo.exe
file is in theD:\Hugo\bin
folder. (It's possible that the extract put it in a sub-directory. If it did, use Windows Explorer to move it toD:\Hugo\bin
.) - Add the hugo.exe executable to your PATH with:
D:\Hugo\bin>set PATH=%PATH%;D:\Hugo\bin
Verify the executable
Run a few commands to verify that the executable is ready to run and then build a sample site to get started.
-
Open a command prompt window.
-
At the prompt, type
hugo help
and press the Enter key. You should see output that starts with:{{< nohighlight >}}A Fast and Flexible Static Site Generator built with love by spf13 and friends in Go. Complete documentation is available at http://gohugo.io {{< /nohighlight >}}
If you do, then the installation is complete. If you don't, double-check the path that you placed the
hugo.exe
file in and that you typed that path correctly when you added it to your PATH variable. If you're still not getting the output, post a note on the Hugo discussion list (in theSupport
topic) with your command and the output. -
At the prompt, change your directory to the
Sites
directory.{{< nohighlight >}}C:\Program Files> cd D:\Hugo\Sites C:\Program Files> D: D:\Hugo\Sites> {{< /nohighlight >}}
-
Run the command to generate a new site. I'm using
example.com
as the name of the site.{{< nohighlight >}}D:\Hugo\Sites> hugo new site example.com {{< /nohighlight >}}
-
You should now have a directory at
D:\Hugo\Sites\example.com
. Change into that directory and list the contents. You should get output similar to the following:{{< nohighlight >}}D:\Hugo\Sites>cd example.com D:\Hugo\Sites\example.com>dir Directory of D:\hugo\sites\example.com 04/13/2015 10:44 PM <DIR> . 04/13/2015 10:44 PM <DIR> .. 04/13/2015 10:44 PM <DIR> archetypes 04/13/2015 10:44 PM 83 config.toml 04/13/2015 10:44 PM <DIR> content 04/13/2015 10:44 PM <DIR> data 04/13/2015 10:44 PM <DIR> layouts 04/13/2015 10:44 PM <DIR> static 1 File(s) 83 bytes 7 Dir(s) 6,273,331,200 bytes free {{< /nohighlight >}}
You now have Hugo installed and a site to work with. You need to add a layout (or theme), then create some content. Go to http://gohugo.io/overview/quickstart/ for steps on doing that.
Troubleshooting
@dhersam has a nice video on common issues at https://www.youtube.com/watch?v=c8fJIRNChmU