hugo_start() starts a hugo server that will automatically re-generate the site whenever the input changes. You only need to execute this once per session; it continues to run in the background as you work on the site. For large sites the hugo server can be slow to start; if it takes longer than 30 seconds hugo_start() throws an error.

hugo_stop() kills the server. This happens automatically when you exit R so you shouldn't normally need to run this.

hugo_browse() opens the site in the RStudio viewer or your web browser.

hugo_start(
  site = ".",
  auto_navigate = TRUE,
  browse = TRUE,
  render_to_disk = FALSE,
  port = 1313
)

hugo_stop()

hugo_browse()

Arguments

site

Path to hugo site.

auto_navigate

Automatically navigate to the most recently changed page?

browse

Automatically preview the site after the server starts?

render_to_disk

Render site to disk? The default is to serve the site from memory, but rendering to disk can be helpful for debugging.

port

Port to run server on. For advanced use only.

Hugo version

hugodown will attempt to automatically use the correct version of hugo for your site (prompting you to call hugo_install() if needed). It looks in two places:

  • If _hugodown.yaml is present, it looks for the hugo_version key.

  • If netlify.toml is present, it looks in context$production$environment$HUGO_VERSION

This means if you already use netlify, hugodown will automatically match the version of hugo that you're using for deployment.