Skip to contents

Builds a complete pkgdown site ready to deploy. Use serve() or preview() for a live preview while you edit, or check() to verify the site in a temporary copy without modifying files in your package.

Usage

build(
  pkg = ".",
  destination = NULL,
  document = TRUE,
  lazy = FALSE,
  quiet = FALSE,
  pandoc = getOption("updoc.pandoc", NULL)
)

Arguments

pkg

Path to an R package (or any file or folder inside it). Defaults to the current directory (".").

destination

Optional output folder to write the site into instead of pkgdown's default. Relative paths are resolved from the package root.

document

Whether to run roxygen2 before building. Set to FALSE if you manage man/ files yourself. Even when FALSE, README.Rmd is still rendered if present.

lazy

Whether to skip rebuilding reference pages and articles whose output is already newer than their source files.

quiet

Whether to hide detailed pkgdown output in the console. Build progress, warnings, and errors are still shown.

pandoc

Path to the directory containing the pandoc binary (version 2.10.1 or newer). When NULL (the default), updoc uses the Pandoc found by rmarkdown. Set options(updoc.pandoc = "/path/to/bin") to reuse a specific directory across builds. updoc never downloads Pandoc or changes your system installation.

Value

Invisibly, an updoc_build object with package_root, site_dir, duration, lazy, and build_log. The full build log is saved in the current R session's temporary directory; if a build fails, the error message includes the log path and the error condition carries it in $build_log.

Details

Unlike a live preview, build() writes directly to your package: it updates roxygen documentation (unless document = FALSE), renders README.Rmd to README.md if present, and builds the site into your configured pkgdown output folder (usually docs/). It does not upload the site anywhere; publish that folder with your usual hosting setup.

Examples

if (interactive()) {
  # Run from your package directory when you are ready to publish.
  build()
}