YAML in blogdown comes from a variety of sources. Most YAML will be for your posts, as described in the blogdown book). Common R Markdown fields can be used, but there are two other main sources for YAML fields: Hugo itself and the Hugo theme you are using. Hugo has numerous top-level YAML to control the output (see the Hugo documentation). yml_blogdown_opts() supports Hugo YAML. Your Hugo theme may also add fields to use. To find YAML specific to your theme, see blogdown_template(). In addition to these sources of YAML, the configuration file for your blog can also be in YAML, but this is not very common; most use a config.toml file, based on TOML (see the blogdown book for more).

yml_blogdown_opts(
  .yml,
  draft = yml_blank(),
  publishdate = yml_blank(),
  weight = yml_blank(),
  slug = yml_blank(),
  aliases = yml_blank(),
  audio = yml_blank(),
  date = yml_blank(),
  description = yml_blank(),
  expiration_date = yml_blank(),
  headless = yml_blank(),
  images = yml_blank(),
  keywords = yml_blank(),
  layout = yml_blank(),
  lastmod = yml_blank(),
  link_title = yml_blank(),
  resources = yml_blank(),
  series = yml_blank(),
  summary = yml_blank(),
  title = yml_blank(),
  type = yml_blank(),
  url = yml_blank(),
  videos = yml_blank(),
  ...
)

Arguments

.yml

a yml object created by yml(), as_yml(), or returned by a yml_*() function

draft

Logical. Set post as a draft? Draft posts will not be rendered if the site is built via blogdown::build_site() or blogdown::hugo_build() but will be rendered in the local preview mode. See Section D.3 of the blogdown book.

publishdate

A future date to publish the post. Future posts are only rendered in the local preview mode

weight

This field can take a numeric value to tell Hugo the order of pages when sorting them, e.g., when you generate a list of all pages under a directory, and two posts have the same date, you may assign different weights to them to get your desired order on the list

slug

A character string used as the tail of the post URL. It is particularly useful when you define custom rules for permanent URLs. See Section 2.2.2 of the blogdown book.

aliases

A character vector of one or more aliases (e.g., old published paths of renamed content) that will be created in the output directory structure

audio

A character vector of paths to audio files related to the page

date

The date assigned to this page. This is usually fetched from the date field in front matter, but this behavior is configurable.

description

The description for the content

expiration_date

the date at which the content should no longer be published by Hugo. Note that the actual YAML field is expiryDate

headless

if TRUE, sets a leaf bundle to be headless.

images

A character vector of paths to images related to the page

keywords

A character vector of the keywords for the content.

layout

The layout Hugo should use while rendering the content. By default, layout matches type and is thus based on the directory. However, it's possible to use additional layouts within a type. See Hugo's Defining a Content Type documentation.

lastmod

The date the content was last modified at

link_title

used for creating links to content. Note that the actual YAML field is linkTitle

resources

A named list. Used for configuring page bundle resources. See Hugo's Page Resources documentation

series

A character vector of series this page belongs to

summary

A summary of the content in the .Summary Hugo page variable; see the content-summaries section of Hugo's documentation.

title

The title for the content

type

The type of the content, which is based on the from the directory of the content if not specified

url

The full path to the content from the web root

videos

A character vector of paths to videos related to the page

...

additional named R objects, such as characters or lists, to transform into YAML

Value

a yml object

Examples


yml() %>%
  yml_blogdown_opts(
    draft = TRUE,
    slug = "blog-post"
  )
#> ---
#> date: '`r format(Sys.Date())`'
#> draft: true
#> slug: blog-post
#> ---
#>