plain text website

If it wasn't apparent already I'm quite fond of minimalist / brutalist design, and that has bled over into the sparse styling in place on this site itself.

Up to this point I have used a monospace font styled with just a few lines of CSS, however when curl'ing my site to retrieve some data from my /blog, I would always get frustrated at the unecessary HTML tags when all I wanted was the plain text content.

To mitigate this, I have modified my site's build scripts to generate a plain text version of all the requisite pages available at /text. When curl'ing the site, NGNIX will automatically redirect to the /text version of the site for all pages.

This is achieved by using the "Evil If" in NGINX:
if ( $http_user_agent ~ 'curl/' ) {
  return 302 /text$uri;
}
This can be overridden by setting a custom User-Agent header in curl requests if the original stylized page is desired.

last updated 2022-08-20