pkgdown is a great tool for generating a website with documentation for an R package.

Unfortunately, pkgdown uses CDNs (content delivery networks) like Cloudflare to embed often used JavaScript libraries into the generated website. Also, fonts are included in such a way. That’s a good idea when these files are cached over websites away.

But in Germany due to GDPR, it’s only allowed to do so after the user has given his consent.

There was a verdict in Germany that you need the consent of the user before you are allowed to embed Google fonts (see German article It’s expected that this is also true for other resources delivered by CDNs.

So I was looking for a simple solution to host a pkgdown site in Germany.

The solution is a custom theme that contains all critical files and doesn’t reference to CDNs. And how do you use such a custom theme? ** Build a package! **

So I wrote pkgdown4gdpr:

It only overwrites the critical files of the original theme.

Using the package is simple. After installing it locally you only need to add this to your _pkgdown.yml:

  bootstrap: 5
  package: pkgdown4gdpr


This package is still work in progress. It works for me. There may be configurations or options which trigger downloading further files. So please double-check on your own when using this package.