Download the appropriate Hugo executable for your platform from Github and
try to copy it to a system directory so blogdown can run the
hugo
command to build a site. update_hugo()
is a wrapper of
install_hugo(force = TRUE)
.
install_hugo(version = "latest", use_brew = Sys.which("brew") != "", force = FALSE,
extended = TRUE)update_hugo()
The Hugo version number, e.g., 0.26
; the special value
latest
means the latest version (fetched from Github releases).
Alternatively, this argument can take a file path of the zip archive or
tarball of the Hugo installer that has already been downloaded from Github,
in which case it will not be downloaded again.
Whether to use Homebrew (https://brew.sh) on macOS to
install Hugo (recommended if you have already installed Homebrew). Note
Homebrew will be automatically installed if it has not been installed when
use_brew = TRUE
.
Whether to install Hugo even if it has already been installed.
This may be useful when upgrading Hugo (if you use Homebrew, run the
command brew update && brew upgrade
instead).
Whether to use extended version of Hugo that has SCSS/SASS support. You only need the extended version if you want to edit SCSS/SASS.
This function tries to install Hugo to Sys.getenv('APPDATA')
on
Windows, ~/Library/Application Support
on macOS, and ~/bin/
on
other platforms (such as Linux). If these directories are not writable, the
package directory Hugo
of blogdown will be used. If it still
fails, you have to install Hugo by yourself and make sure it can be found via
the environment variable PATH
.
This is just a helper function and may fail to choose the correct Hugo executable for your operating system, especially if you are not on Windows or Mac or a major Linux distribution. When in doubt, read the Hugo documentation and install it by yourself: https://gohugo.io.
If you want to install Hugo to a custom path, you can set the global option
blogdown.hugo.dir
to a directory to store the Hugo executable before
you call install_hugo()
, e.g., options(blogdown.hugo.dir =
'~/Downloads/hugo_0.20.1/')
. This may be useful for you to use a specific
version of Hugo for a specific website. You can set this option per project.
See Section
1.4 Global options for details, or store a copy of Hugo on a USB Flash drive
along with your website.