Skip to content

Create a new blog post

Usage

create_post(
  title,
  collection = "posts",
  author = "auto",
  slug = "auto",
  date = Sys.Date(),
  date_prefix = date,
  draft = FALSE,
  edit = interactive()
)

Arguments

title

Post title

collection

Collection to create the post within (defaults to "posts")

author

Post author. Automatically drawn from previous post if not provided.

slug

Post slug (directory name). Automatically computed from title if not provided.

date

Post date (defaults to current date)

date_prefix

Date prefix for post slug (preserves chronological order for posts within the filesystem). Pass NULL for no date prefix.

draft

Mark the post as a draft (don't include it in the article listing).

edit

Open the post in an editor after creating it.

Note

This function must be called from with a working directory that is within a Distill website.

Examples

if (FALSE) {
library(distill)
create_post("My Post")
}