build_site: Build a website

Description Usage Arguments Details Note

View source: R/render.R

Description

Compile all Rmd files and build the site through Hugo.

Usage

1
build_site(local = FALSE, method = c("html", "custom"), run_hugo = TRUE)

Arguments

local

Whether to build the website locally to be served via serve_site().

method

Different methods to build a website (each with pros and cons). See Details. The value of this argument will be obtained from the global option getOption('blogdown.method') when it is set.

run_hugo

Whether to run hugo_build() after R Markdown files are compiled.

Details

You can use serve_site() to preview your website locally, and build_site() to build the site for publishing.

For the method argument: method = "html" means to render all Rmd files to HTML via rmarkdown::render() (which means Markdown is processed through Pandoc), and process the paths of external dependencies generated from R code chunks, including images and HTML dependencies.

For all rendering methods, a custom R script ‘R/build.R’ will be executed if you have provided it under the root directory of the website (e.g. you can compile Rmd to Markdown through knitr::knit() and build the side via hugo_cmd()). method = "custom" means it is entirely up to this R script how a website is rendered. The script is executed via command line Rscript "R/build.R", which means it is executed in a separate R session. The value of the argument local is passed to the command line (you can retrieve the command-line arguments via commandArgs(TRUE)).

Note

This function recompiles all R Markdown files by default, even if the output files are newer than the source files. If you want to build the site without rebuilding all R Markdown files, you should use hugo_build() instead.


blogdown documentation built on Nov. 14, 2019, 1:06 a.m.