Create a new blog post from a template. This function can also be run
interactively using the
Create post (from template) RStudio addin.
create_post_from_template( path, title, collection = "posts", author = "auto", slug = "auto", date = Sys.Date(), date_prefix = date, draft = FALSE, edit = interactive() )
File path to
Post title. If there is a title in the template, this will override it.
Collection to create the post within (defaults to "posts")
Post author. If not provided, it will be automatically drawn from template. If not in template, it will be automatically drawn from previous post.
Post slug (directory name). Automatically computed from title if not provided.
Post date (defaults to current date)
Date prefix for post slug (preserves chronological order for posts
within the filesystem). Pass
Mark the post as a
Open the post in an editor after creating it.
create_post_from_template function is designed to work as closely as
distill::create_post(). The main difference is the compulsory
path argument, which gives the path of the R Markdown template to create
the post from.
create_post_from_template interactively using the
Create post (from template) RStudio addin, a list of available templates is
provided to choose from through a dropdown menu. The contents of this list
are retrieved using the
available_templates() function, which looks for
R Markdown post templates in
./templates by default. The global option
distilltools.templates.path can be used to change the directory
available_templates() looks in (See
?available_templates for details).
In addition to local templates, the
Create post (from template) RStudio
addin will always make available a default template named "Default" that
matches the one from
This function must be called from a working directory that is within a Distill website.
The output for a post must be
distill::distill_article. If there is no
output key in the provided template, this will be added to the yaml. If
there is an
output specified in the template yaml, it must be
throw an error.
automatically provide a
description key in the yaml.