hugo_cmd | R Documentation |
Wrapper functions to run Hugo commands via system2('hugo',
...)
.
hugo_cmd(...)
hugo_version()
hugo_available(version = "0.0.0", exact = FALSE)
hugo_build(
local = FALSE,
args = getOption("blogdown.hugo.args"),
baseURL = NULL,
relativeURLs = NULL
)
new_site(
dir = ".",
force = NA,
install_hugo = TRUE,
format = "yaml",
sample = TRUE,
theme = "yihui/hugo-lithium",
hostname = "github.com",
theme_example = TRUE,
empty_dirs = FALSE,
to_yaml = TRUE,
netlify = TRUE,
.Rprofile = TRUE,
serve = if (interactive()) "ask" else FALSE
)
new_content(path, kind = "", open = interactive())
new_post(
title,
kind = "",
open = interactive(),
author = getOption("blogdown.author"),
categories = NULL,
tags = NULL,
date = Sys.Date(),
time = getOption("blogdown.time", FALSE),
file = NULL,
slug = NULL,
title_case = getOption("blogdown.title_case"),
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 |
version |
A version number. |
exact |
If |
local |
Whether to build the site for local preview (if |
args |
A character vector of command-line arguments to be passed to
|
baseURL , relativeURLs |
Custom values of |
dir |
The directory of the new site. |
force |
Whether to create the site in a directory even if it is not
empty. By default, |
install_hugo |
Whether to install Hugo automatically if it is not found. |
format |
The format of the configuration file, e.g., |
sample |
Whether to add sample content. Hugo creates an empty site by default, but this function adds sample content by default. |
theme |
A Hugo theme on Github (a character string of the form
|
hostname |
Where to find the theme. Defaults to |
theme_example |
Whether to copy the example in the ‘exampleSite’ directory if it exists in the theme. Not all themes provide example sites. |
empty_dirs |
Whether to keep the empty directories generated by Hugo. |
to_yaml |
Whether to convert the metadata of all posts to YAML. |
netlify |
Whether to create a Netlify config file ‘netlify.toml’. |
.Rprofile |
Whether to create a ‘.Rprofile’ file. If |
serve |
Whether to start a local server to serve the site. By default, this function will ask you in an interactive R session if you want to serve the site. |
path |
The path to the new file under the ‘content’ directory. |
kind |
The content type to create, i.e., the Hugo archetype. If the
archetype is a page bundle archetype, it should end with a slash, e.g.,
|
open |
Whether to open the new file after creating it. By default, it is opened in an interactive R session. |
title |
The title of the post. |
author |
The author of the post. |
categories |
A character vector of category names. |
tags |
A character vector of tag names. |
date |
The date of the post. |
time |
Whether to include the time of the day in the |
file |
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. |
slug |
The slug of the post. By default ( |
title_case |
A function to convert the title to title case. If
|
subdir |
If specified (not |
ext |
The filename extension (e.g., ‘.md’, ‘.Rmd’, or
‘.Rmarkdown’). Ignored if |
to |
A format to convert to. |
unsafe |
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 |
host , port |
The host IP address and port; see
|
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_available()
: Check if Hugo of a certain version (or above if
exact = FALSE
) is available.
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: https://themes.gohugo.io.
blogdown::hugo_available("1.2.3")
if (interactive()) blogdown::new_site()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.