Wrapper functions to run Hugo commands via system2('hugo',
...)
.
hugo_cmd(...)hugo_version()
hugo_build(local = FALSE, config = load_config())
new_site(dir = ".", install_hugo = TRUE, format = "toml",
sample = TRUE, theme = "yihui/hugo-lithium-theme", theme_example = TRUE,
serve = interactive())
new_content(path, kind = "default", open = interactive())
new_post(title, kind = "default", open = interactive(),
author = getOption("blogdown.author"), categories = NULL,
tags = NULL, date = Sys.Date(), file = NULL, slug = NULL,
subdir = getOption("blogdown.subdir", "post"), ext = getOption("blogdown.ext",
".md"))
hugo_convert(to = c("YAML", "TOML", "JSON"), unsafe = FALSE,
...)
hugo_server(host, port)
Arguments to be passed to system2('hugo', ...)
, e.g.
new_content(path)
is basically hugo_cmd(c('new', path))
(i.e.
run the command hugo new path
).
Whether to build the site for local preview (if TRUE
, all
drafts and future posts will also be built, and the site configuration
baseurl
will be set to /
temporarily).
A list of the site configurations (by default, read from
config.toml
or config.yaml
).
The directory of the new site. It should be empty or only contain
hidden files, RStudio project (*.Rproj
) files, LICENSE
,
and/or README
/README.md
.
Whether to install Hugo automatically if it is not found.
The format of the configuration file. Note that the frontmatter
of the new (R) Markdown file created by new_content()
always uses
YAML instead of TOML.
Whether to add sample content. Hugo creates an empty site by default, but this function adds sample content by default).
A Hugo theme on Github (a chararacter string of the form
user/repo
, and you can optionally sepecify a GIT branch or tag name
after @
, i.e. theme
can be of the form
user/repo@branch
). If theme = NA
, no themes will be
installed, and you have to manually install a theme.
Whether to copy the example in the exampleSite
directory if it exists in the theme. Not all themes provide example sites.
Whether to start a local server to serve the site.
The path to the new file under the content
directory.
The content type to create.
Whether to open the new file after creating it. By default, it is opened in an interactive R session.
The title of the post.
The author of the post.
A character vector of category names.
A character vector of tag names.
The date of the post.
The filename of the post. By default, the filename will be
automatically generated from the title by replacing non-alphanumeric
characters with dashes, e.g. title = 'Hello World'
may create a file
content/post/2016-12-28-hello-world.md
. The date of the form
YYYY-mm-dd
will be prepended if the filename does not start with a
date.
The slug of the post. By default (NULL
), the slug is
generated from the filename by removing the date and filename extension,
e.g., if file = 'post/2015-07-23-hi-there.md'
, slug
will be
hi-there
. Set slug = ''
if you do not want it.
If specified (not NULL
), the post will be generated
under a subdirectory under content/
. It can be a nested subdirectory
like post/joe/
.
The filename extension (e.g., .md
, .Rmd
, or
.Rmarkdown
). Ignored if file
has been specified.
A format to convert to.
Whether to enable unsafe operations, such as overwriting
Markdown source documents. If you have backed up the website, or the
website is under version control, you may try unsafe = TRUE
.
The host IP address and port; see
servr::server_config()
.
hugo_cmd
: Run an arbitrary Hugo command.
hugo_version
: Return the version number of Hugo if possible, which is
extracted from the output of hugo_cmd('version')
.
hugo_build
: Build a plain Hugo website. Note that the function
build_site()
first compiles Rmd files, and then calls Hugo
via hugo_build()
to build the site.
new_site
: Create a new site (skeleton) via hugo new
site
. The directory of the new site should be empty,
new_content
: Create a new (R) Markdown file via hugo new
(e.g. a post or a page).
new_post
: A wrapper function to create a new post under the
content/post/
directory via new_content()
. If your post will
use R code chunks, you can set ext = '.Rmd'
or the global option
options(blogdown.ext = '.Rmd')
in your ~/.Rprofile
.
Similarly, you can set options(blogdown.author = 'Your Name')
so
that the author field is automatically filled out when creating a new post.
hugo_convert
: A wrapper function to convert source content to
different formats via hugo convert
.
hugo_server
: Start a Hugo server.
The full list of Hugo commands: https://gohugo.io/commands, and themes: http://themes.gohugo.io.