distill
distill copied to clipboard
Add archetypes functionality to distill blogs
It would be great if distill supported Rmd templates/archetypes that allow the user to customize the default Rmd file generated by distill::create_post(), similar to what blogdown allows. I've posted a workaround on my own blog, but I'd imagine this is something others would appreciate as part of the distill package.
Hello, I was inspired by @ekholme's blogpost mentioned above to come up with a solution for this, and have since seen that he raised the issue here. I have written a function called create_post_from_template
which works pretty much identically to distill::create_post
except with the addition of a path
argument which specifies the path to the template. At the moment, I've put the function in a new package, {distilltools}, which is on GitHub and has a pkgdown site too (I have big ambitions for {distilltools} beyond this!).
For lots of reasons, I think the function would sit better in {distill}, either as is or by modifying create_post
to add an optional path
argument which would default to NULL
(in which case create_post
would work exactly as it currently does, or if path
is specified, then code from create_post_from_template
takes over. Having this function in {distill} makes sense because there's a lot of duplicated code, and from a maintenance point of view, as well as avoiding various complexities around the license and authorship of {distilltools}. Also, this seems like a fairly core bit of functionality for {distill}, rather than {distilltools} which I see more as a collection of nice-to-have extras.
I would be delighted to submit a pull request to {distill} with this, and have exchanged some preliminary messages about that with @apreshill in DMs on twitter, but now think GitHub issues is a better place to move that conversation forward.
Would you prefer a pull request for a separate create_post_from_template
function, or for a modified version of create_post
?
@cderv, @apreshill, I really look forward to working with you on this!
Docs here now! 🚀 https://ellakaye.github.io/distilltools/reference/create_post_from_template.html