How does one serve cookie-free content with a Hugo framework?

I often get messages that my site should consider hosting static content from a cookie-free domain, and there seems to be plenty of tutorials showing how to do this on wordpress (by creating a subdomain or manipulating a .htaccess file, but how would one configure disabling cookies via Hugo?)

Purely static sites do not make cookies, so those are coming from some javascript on your site, like using google analytics or disqus etc. I would say: Look at your browser’s dev console and see what cookies are being made, and chase them down one by one.

Thanks for replying. Indeed, I do use both of those so how would I deal with those files? For example, I also self host several JS files like katex, bootstrap, jquery, fontface

You can control a bit about privacy settings using internal templates:

… but I am not sure what you are trying to do. If you want to eliminate cookies altogether, you stop using anything that makes them. If you want to serve js from your own domain, you can serve from the static folder in your project. So, /static/js/somelib.js is published to //

1 Like

Who sends you those messages?

Not actual messages, but results from websites like GTMetrix or Pingdom.