_site.yml
and navbars for R Markdown websitesR/yml_rmarkdown.R
yml_site_opts.Rd
R Markdown has a simple website builder baked in (see the R Markdown book
for a detailed description). An R Markdown website must have at least have an
index.Rmd
file and a _site.yml
file (which can be empty). Including YAML
in _site.yml
will apply it to all R Markdown files for the website, e.g.
setting the output format here will tell R Markdown to use that format across
the website. R Markdown websites also support navbars, which you can specify
with YAML (see yml_navbar()
, as well as ?rmarkdown::render_site and
?rmarkdown::html_document). Pass navbar_page()
to the left
or right
field to set up page tabs and use navbar_separator()
to include a
separators. In addition to writing YAML with yml_*()
functions,
use_site_yml()
will take the a yml
object and write it to a _site.yml
file for you.
yml_site_opts(
.yml,
name = yml_blank(),
favicon = yml_blank(),
output_dir = yml_blank(),
include = yml_blank(),
exclude = yml_blank(),
new_session = yml_blank(),
...
)
yml_navbar(
.yml,
title = yml_blank(),
type = yml_blank(),
left = yml_blank(),
right = yml_blank(),
...
)
navbar_page(
text = yml_blank(),
href = yml_blank(),
icon = yml_blank(),
menu = yml_blank(),
...
)
navbar_separator()
a yml
object created by yml()
, as_yml()
, or returned by
a yml_*()
function
The name of the website
Path to a file to use as the favicon
Directory to copy site content into ("_site" is the default if none is specified)
Files to include or exclude from the copied into
output_dir
. You can use *
to indicate a wildcard selection, e.g.
"*.csv".
Logical. Should each website file be rendered in a new R session?
additional named R objects, such as characters or lists, to transform into YAML
The title of the website
The color scheme for the navigation bar: either "default" or "inverse".
the side of the navbar a navbar_page()
should go (see example)
The link text
The link URL
An icon to include
drop-down menus specified by including another navbar_page()
a yml
object
use_site_yml()
use_navbar_yml()
use_index_rmd()
Other yml:
asis_yaml_output()
,
bib2yml()
,
draw_yml_tree()
,
has_field()
,
read_json()
,
use_yml_defaults()
,
use_yml_file()
,
use_yml()
,
yml_author()
,
yml_blogdown_opts()
,
yml_bookdown_opts()
,
yml_citations()
,
yml_clean()
,
yml_distill_opts()
,
yml_latex_opts()
,
yml_output()
,
yml_pagedown_opts()
,
yml_params()
,
yml_pkgdown()
,
yml_reference()
,
yml_replace()
,
yml_resource_files()
,
yml_rsconnect_email()
,
yml_rticles_opts()
,
yml_runtime()
,
yml_toc()
,
yml_vignette()
Other R Markdown:
yml_clean()
,
yml_params()
,
yml_runtime()
,
yml_vignette()
Other websites:
yml_distill_opts()
,
yml_pkgdown()
yml_empty() %>%
yml_site_opts(
name = "my-website",
output_dir = "_site",
include = "demo.R",
exclude = c("docs.txt", "*.csv")
) %>%
yml_navbar(
title = "My Website",
left = list(
navbar_page("Home", href = "index.html"),
navbar_page(navbar_separator(), href = "about.html")
)
) %>%
yml_output(html_document(toc = TRUE, highlight = "textmate"))
#> ---
#> name: my-website
#> output_dir: _site
#> include: demo.R
#> exclude:
#> - docs.txt
#> - '*.csv'
#> navbar:
#> title: My Website
#> left:
#> - text: Home
#> href: index.html
#> - text: '---------'
#> href: about.html
#> output:
#> html_document:
#> toc: true
#> highlight: textmate
#> ---
#>