Skip to content

Search for Hugo in a series of possible installation directories (see install_hugo() for these directories) with find_hugo(), or remove the Hugo executable(s) found with remove_hugo().

Usage

find_hugo(version = getOption("blogdown.hugo.version"), quiet = FALSE)

remove_hugo(version = getOption("blogdown.hugo.version"), force = FALSE)

Arguments

version

The expected version number, e.g., '0.25.1'. If NULL, it will try to find/remove the maximum possible version. If 'all', find/remove all possible versions. In an interactive R session when version is not provided, remove_hugo() will list all installed versions of Hugo, and you can select which versions to remove.

quiet

Whether to signal a message when two versions of Hugo are found: one is found on the system PATH variable, and one is installed by install_hugo().

force

By default, remove_hugo() only removes Hugo installed via install_hugo(). For force = TRUE, it will try to remove any Hugo executables found via find_hugo().

Value

For find_hugo(), it returns the path to the Hugo executable if found, otherwise it will signal an error, with a hint on how to install (the required version of) Hugo. If Hugo is found via the environment variable PATH, only the base name of the path is returned (you may use Sys.which('hugo') to obtain the full path).

If version = 'all', return the paths of all versions of Hugo installed.

Details

If your website depends on a specific version of Hugo, we strongly recommend that you set options(blogdown.hugo.version = ) to the version number you desire in the file .Rprofile in the root directory of the website project, so that blogdown can try to find the right version of Hugo before it builds or serves the website. You can use the function config_Rprofile() to do this automatically.