Installing Hugo

Hugo is available as a single binary. You can install Hugo two ways: using a package manager, or by downloading the binary manually and placing it in a global location so you can run it anywhere.

Hugo comes in two versions: a regular version and an extended version that has additional support for asset management, which you’ll want in Chapter 7, Managing Assets with Pipes.

Package managers are utilities that let you install and remove programs and utilities. Linux systems often have a built-in package manager. If you’re running macOS, you can install the Homebrew[7] package manager. If you’re using Windows, you can install Chocolatey.[8] Finally, Linux users can install Linuxbrew,[9] a version of Homebrew for Linux that offers more up-to-date packages than the package manager that comes with their system.

Installation via a package manager is the easiest method, although you might not always get the most recent version.

If you’re using a Mac and you have Homebrew installed, you can install the extended version of Hugo with:

 $ ​​brew​​ ​​install​​ ​​hugo

On Windows, if you have Chocolatey installed, you can install Hugo with this command:

 $ ​​choco​​ ​​install​​ ​​-y​​ ​​hugo-extended

To install Hugo manually, find the extended version’s binary for your operating system on the Releases page[10] on GitHub. For example, if you’re on Windows, you’re looking for a filename like hugo-extended-x.y.z-Windows-64bit.zip. Download the file.

Now that you’ve manually downloaded the file, you’ll want to add it to your PATH environment variable, which your command-line interface uses to determine where it can find executable programs. That way you can execute it without specifying the full directory location.

On macOS or Linux, copy the executable to /usr/local/bin, which is already included in your PATH environment variable by default.

On Windows 10, create the directory C:hugoin. Copy the hugo.exe file you extracted to C:hugoin, and then add that folder to your PATH environment variable. To do this, use the Windows Search and type “environment”. Choose the option for Edit Environment Variables for My Account. On the screen that appears, press the Environment Variables button, locate PATH in the System Variables section, and press the Edit button. Add c:hugoin. Press OK to save the settings, and then press OK on the rest of the dialogs to close them.

Once Hugo is installed, run the hugo version command from your command-line interface to ensure that Hugo is available in any directory on your system, and that you’ve installed the extended version:

 $ ​​hugo​​ ​​version
 Hugo Static Site Generator v0.68.3/extended darwin/amd64 BuildDate: unknown

The hugo command has several subcommands that you’ll use as you build your site. You can see a list of all commands with hugo help.

Hugo is installed and ready. Let’s use it to build a basic site.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.203.172