A more privacy-friendly blog

Vincent Bernat

TL;DR (2026)

This blog does not rely on any third-party ser­vice that tracks users. My own servers run Caddy and serve the HTML pages and video files. Caddy trun­cates IP ad­dresses in its logs and keeps them for 30 days. Bunny CDN serves the other as­sets, with its ac­cess logs disabled.

Fonts, an­a­lyt­ics and com­ments are all self-hosted. Goat­Counter pro­vides an­a­lyt­ics with­out cook­ies or per­sonal data. Com­ments use Isso, and Caddy re­moves its cook­ies. With Java­Script, search uses Pagefind, a lo­cal in­dex built with the site. With­out Java­Script, it falls back to Duck­DuckGo. You can sub­scribe to up­dates through the RSS feed. There is no newsletter.

Java­Script is mostly op­tional. When server-side ren­der­ing or CSS can do the job, I avoid Java­Script. For ex­am­ple, math­e­mat­i­cal for­mu­lae are ren­dered on the server side, and side­notes are placed in the mar­gin with CSS only. The CSP header shows the full list of al­lowed re­sources.

When I started this blog, I em­braced free ser­vices like Dis­qus and Google An­a­lyt­ics. These ser­vices are in­va­sive to users’ pri­vacy. Over the years, I have worked to elim­i­nate them and reach a point where I do not rely on any “pri­vacy-hos­tile” service.

Analytics#

Google An­a­lyt­ics is a ubiq­ui­tous way to get pow­er­ful an­a­lyt­ics for free. It also feeds data about your vis­i­tors to Google—also for free. Self-hosted al­ter­na­tives ex­ist, like Matomo, Goat­Counter, or Plausible.

I opted for a sim­pler so­lu­tion: no an­a­lyt­ics at all. This also lets me be­lieve that my blog at­tracts thou­sands of vis­i­tors every day.

Up­date (2019-02)

For server-side logs, IP ad­dresses are anonymized us­ing ip­scrub, a mod­ule for ng­inx. How­ever, non-HTML as­sets are served through Ama­zon CloudFront.1

Up­date (2026-09)

I have switched Goat­Counter, a pri­vacy-friendly an­a­lyt­ics plat­form: no cook­ies, no cross-site track­ing, and no col­lec­tion of per­sonal data. Cur­rently, I self-host my own in­stance. 🐐

Up­date (2026-10)

I have switched to Caddy as a web server and Bunny as a CDN. I have con­fig­ured Caddy to trun­cate IP ad­dresses. I have set up Bunny CDN to not store ac­cess logs.

Fonts#

Google Fonts is a pop­u­lar font li­brary and host­ing ser­vice that re­lies on the generic Google Pri­vacy Pol­icy. The google-web­fonts-helper ser­vice makes it easy to self-host any font from Google Fonts. With help from pyftsubset, I only in­clude the char­ac­ters used in this blog. The font files are lighter and more com­plete: no prob­lem spell­ing “An­tonín Dvořák.”

Videos#

  • Be­fore: YouTube
  • Af­ter: self-hosted

Some ar­ti­cles in­clude a video—like “OPL2LPT: an AdLib sound card for the par­al­lel port.” I pre­vi­ously used YouTube, mostly be­cause it was the only free plat­form with an op­tion to dis­able ads. Stream­ing on-de­mand videos is usu­ally con­sid­ered dif­fi­cult. For ex­am­ple, if you just use the <video> tag, you may push a video too large for peo­ple with a slow con­nec­tion. How­ever, it is not that hard: hls.js en­ables us to de­liver video sliced in seg­ments avail­able at dif­fer­ent bi­trates. Users with Java­Script dis­abled are still de­liv­ered with a pro­gres­sive ver­sion of medium quality.

In “Self-hosted videos with HLS,” I ex­plain this ap­proach in more detail.

Up­date (2026-11)

I have switched from hls.js to Video.js, also self-hosted.

Comments#

  • Be­fore: Disqus
  • Af­ter: self-hosted, with Isso

Dis­qus is a pop­u­lar com­ment so­lu­tion for static web­sites. Zeta Global, a mar­ket­ing com­pany, ac­quired them, and their busi­ness model re­lies solely on ads. On the tech­ni­cal side, Dis­qus also loads sev­eral hun­dred kilo­bytes of re­sources. Many web­sites there­fore load Dis­qus on de­mand. That is what I did. This does not solve the pri­vacy prob­lem and I felt peo­ple were less ea­ger to leave a com­ment when they had to per­form an ad­di­tional action.

Up­date (2019-01)

A year later, com­ments in­creased sig­nif­i­cantly af­ter re­mov­ing this ad­di­tional step. Be­tween 2011 and 2015, the site col­lected about 140 com­ments. In 2016, Dis­qus was no longer loaded au­to­mat­i­cally and the num­ber of com­ments halved. In 2018, af­ter switch­ing to Isso and au­to­matic load­ing, there were 158 comments.

For some time, I con­sid­ered build­ing my own com­ment sys­tem around Atom feeds. Each page would get its own feed of com­ments. A piece of Java­Script would turn these feeds into HTML, and com­ments could still be read with­out Java­Script, thanks to the de­fault ren­der­ing browsers pro­vide. Peo­ple could also sub­scribe to these feeds: no need for mail no­ti­fi­ca­tions! The feeds would be served as static files and up­dated on new com­ments by a small piece of server-side code. This could also work with­out JavaScript.

Day Planner by Fowl Language Comics
Fowl Language Comics: Day Planner or the real reason why I didn’t code a new comment system.

I still think this is a great idea. But I did not feel like de­vel­op­ing and main­tain­ing a new com­ment sys­tem. Sev­eral self-hosted al­ter­na­tives ex­ist, no­tably Isso and Com­mento. Isso is a bit more fea­ture­ful, with no­tably an im­per­fect im­port from Dis­qus. Both strug­gle with main­te­nance and try to be­come sus­tain­able with a paid hosted ver­sion.2 Com­mento is more pri­vacy-friendly as it does not use cook­ies at all. How­ever, cook­ies from Isso are not es­sen­tial and can be fil­tered with nginx:

proxy_hide_header Set-Cookie;
proxy_hide_header X-Set-Cookie;
proxy_ignore_headers Set-Cookie;

In Isso, there is cur­rently no mail no­ti­fi­ca­tions, but I have added an Atom feed for each com­ment thread.

Up­date (2019-01)

Mail no­ti­fi­ca­tions were re­cently added and I have just en­abled them here. As ab­so­lutely no­body ever used the Atom feeds, I have re­moved them.

An­other op­tion would have been to drop com­ments en­tirely. How­ever, I have re­ceived great con­tri­bu­tions as com­ments and I also think they serve as a form of peer re­view for blog ar­ti­cles: they are a weak guar­an­tee that the con­tent is not wrong.

Search engine#

One way to add a search en­gine to a per­sonal blog is to em­bed a form for a pub­lic search en­gine, like Google. That is what I did. I also slapped some Java­Script on top of it to make it look like not Google.

The so­lu­tion here is easy: switch to Duck­DuckGo, which lets you cus­tom­ize a bit the search ex­perience:

<form id="lf-search" action="https://duckduckgo.com/">
  <input type="hidden" name="kf" value="-1">
  <input type="hidden" name="kaf" value="1">
  <input type="hidden" name="k1" value="-1">
  <input type="hidden" name="sites" value="vincent.bernat.ch/en">
  <input type="submit" value="">
  <input type="text" name="q" value="" autocomplete="off" aria-label="Search">
</form>

The Java­Script part is also re­moved as Duck­DuckGo does not pro­vide an API. Since fewer than three peo­ple likely use the search en­gine in a year, it seems wise not to spend too much time on this non-es­sen­tial feature.

Up­date (2026-04)

When Java­Script is en­abled, search now uses Pagefind, a search en­gine tai­lored for static web­sites. This has the ad­van­tage of cov­er­ing all pages and pro­vid­ing finer con­trol over the index. 🐂

Newsletter#

  • Be­fore: RSS feed
  • Af­ter: RSS feed but also a MailChimp newsletter

Nowa­days, RSS feeds are far less pop­u­lar than they used to be. I am still baf­fled as to why a tech­ni­cal au­di­ence would not use RSS, but some read­ers pre­fer to re­ceive up­dates by mail.

MailChimp is a com­mon so­lu­tion for send­ing news­let­ters. It in­te­grates with RSS feeds to trig­ger a mail each time new items ap­pear in the feed. From a pri­vacy stand­point, MailChimp seems like a good cit­i­zen: data col­lec­tion is mainly lim­ited to what is needed to op­er­ate the ser­vice. Pri­vacy-con­scious users can still avoid it and use the RSS feed.

Up­date (2019-12)

I have re­moved the news­let­ter. There were not many sub­scribers (around 40) and I felt bad about ad­ver­tis­ing such a ser­vice. In­stead, I have added links to RSS-to-email services.

Less JavaScript#

  • Be­fore: third-party Java­Script code
  • Af­ter: self-hosted Java­Script code

Many pri­vacy-con­scious peo­ple dis­able Java­Script or use ex­ten­sions like uMatrix or NoScript. Ex­cept for com­ments, I used Java­Script only for non-es­sen­tial features:

For math­e­mat­i­cal for­mu­lae, I have switched from MathJax to KaTeX. The lat­ter is faster and en­ables server-side ren­der­ing: the client-side Java­Script is not needed anymore.

For side­notes, I have turned the Java­Script code do­ing the trans­for­ma­tion into Python code, with py­query. No more client-side Java­Script for this as­pect either.

The re­main­ing code is still present but self-hosted.

Memento: CSP#

The HTTP Content-Security-Policy header con­trols the re­sources a user agent can load for a given page. It serves as both a safe­guard and a re­minder of the ex­ter­nal re­sources a site uses. Mine is mod­er­ately com­plex and shows what to ex­pect from a pri­vacy standpoint:

Content-Security-Policy:
  default-src     'self' blob:;
  script-src      blob: media-bernat-ch.b-cdn.net 'sha256-k0b7LgV8ZkLI+Nfd9gfqq0b9OtkxP/wr23+WxOBIb30=';
  style-src       'unsafe-inline' data: media-bernat-ch.b-cdn.net;
  font-src        data: media-bernat-ch.b-cdn.net;
  img-src         'self' data: media-bernat-ch.b-cdn.net;
  object-src      media-bernat-ch.b-cdn.net media.bernat.ch;
  frame-src       media-bernat-ch.b-cdn.net media.bernat.ch;
  worker-src      blob:;
  media-src       blob: data: media.bernat.ch media-bernat-ch.b-cdn.net;
  connect-src     'self' comments.luffy.cx media.bernat.ch;
  base-uri        'none';
  frame-ancestors 'self' https:;
  form-action     'self';

I am quite happy hav­ing been able to reach this result. 😊

Up­date (2026-10)

This post was widely dis­cussed on Hacker News and Lobsters.