When building the extended flavor of Hugo from source on Windows, you will need Git, Go and the GCC compiler.
To install the GCC compiler:
-
Download and install 7-Zip.
-
Download Mingw-w64. You want the file with “posix-seh-msvcrt” in its name.
-
Extract the archive with 7-Zip, then move the
mingw64
directory intoC:\Program Files
.C:\Program Files\mingw64 ├───bin ├───etc ├───include ├───lib ├───libexec ├───licenses ├───opt ├───share └───x86_64-w64-mingw32
-
Update the PATH environment variable
-
Right click on the Start menu icon, choose Run, then paste:
rundll32.exe sysdm.cpl,EditEnvironmentVariables
-
Under “User variables” select PATH, press Edit, press New, then paste:
C:\Program Files\mingw64\bin
-
-
Verify that gcc is installed and in your PATH. Open a cmd window then type:
gcc --version
-
Now compile the extended version of Hugo. Change to the directory containing the Hugo codebase, then type:
CGO_ENABLED=1 go install -tags extended
Be patient; it will take a while.
-
Verify the location of the executable by typing
where hugo
. This should display something like:C:\Users\john\go\bin\hugo.exe
-
Verify the version by typing
hugo version
. This should display something like:hugo v0.116.0-DEV-be8e2de59786327a83a1b41bb9f9608a49b5f7a0+extended windows/amd64 BuildDate=2023-07-30T19:12:33Z