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 https://www.golem.de/news/landgericht-muenchen-einbindung-von-google-fonts-ist-rechtswidrig-2202-162826.html). 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: https://github.com/rstats-tips/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:

1
2
3
template:
  bootstrap: 5
  package: pkgdown4gdpr

Disclaimer

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.