title: How to load the same needed packages in multiple blogdown posts?
body: <p>In some but not all posts of a blog made with blogdown I use highcharts to create interactive charts. For this, I need:</p>
  
  <ol>
  <li>Include the necessary highcharts javascript sources in the relevant posts</li>
  <li>Load the <code>highcharter</code> package (and also <code>magrittr</code>, as they work well together) in the relevant .Rmds</li>
  </ol>
  
  <p>For the first point, a fairly elegant solution may be including a new param
  <code>usehighcharts: true</code> in the params of the posts and then in the <code>header.html</code> partial use:</p>
  
  <pre><code>{{ if .Params.usehighcharts }}
   ... include the needed javascript ...
  {{ end }}
  </code></pre>
  
  <p>But for the second point, I do not have an elegant solution, so what I do is manually include a chunk like so in the beginning of the relevant .Rmds, which I find error prone and not very elegant:</p>
  
  <pre><code>```{r echo=FALSE}
  suppressPackageStartupMessages({
    library(highcharter)
    library(magrittr)
  })
  ```
  </code></pre>
  
  <p>What would be a more elegant/best practice solution to this ?</p>