pkgdown and GDPR – How to host a pkgdown site in Germany

[This article was first published on, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

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.

To leave a comment for the author, please follow the link and comment on their blog: offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)