I find myself using a lot of the same R code in my Rmd posts and currently have a template file from where I copy paste this common R code into new posts. However, now I wonder if it's possible to modify the Rmd post template to include these lines of common R code and some reminders to myself on how to do a few things. It would be nice if this worked with the blogdown addin "new post" in RStudio.
I searched here, the blogdown book and the blogdown repo and didn't see information on how to do this. The closest is for modifying the html template, not the Rmd template.
Here's an example Rmd file that I would like to use as my Rmd post template
PS: Blogged about this here.
You can create a template using the file /archetypes/default.md
. Its content will be used for your new posts.
Alternatively, you can use the kind
argument of blogdown::new_post()
(or blogdown::new_content()
), which should be the name of the "archetype" (see Hugo's documentation).
Update: there was a bug in blogdown::new_content()
, which has been fixed by the OP. For now, devtools::install_github('rstudio/blogdown')
should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With