I've set up my blog using blogdown.
Now I would like to define some standard code snippets that should be included in each post (e.g., for centering images). Take this R-code as an example; it should be included automatically in each post:
knitr::opts_chunk$set(
out.width = "70%",
fig.align = 'center'
)
You can do this in .Rprofile
, as explained in Section 1.4 of the blogdown book. The easiest way is probably to use an RStudio project, and create a .Rprofile
file in the root directory of the website project, in which you set the knitr global chunk options.