cmc/dotfiles

Using GNU Stow to manage my dotfiles.

clone: git clone https://gitbay.org/cmc/dotfiles.git

a5d3ecf0aebe1802e4bf8ba834693996425a707f

verified · cmc

author: Christian Cleberg <hello@cleberg.net> · 2026-05-01T15:29:58Z

fix: enable markdown serving via org on cleberg.net
 linux/nginx/etc/nginx/conf.d/cleberg.net.conf      | 39 +++++++++++++++++++++-
 .../sites/cleberg_net_static_locations.conf        | 19 ++++++++---
 2 files changed, 53 insertions(+), 5 deletions(-)

diff --git a/linux/nginx/etc/nginx/conf.d/cleberg.net.conf b/linux/nginx/etc/nginx/conf.d/cleberg.net.conf
index 7fcb683..04cd3c5 100644
--- a/linux/nginx/etc/nginx/conf.d/cleberg.net.conf
+++ b/linux/nginx/etc/nginx/conf.d/cleberg.net.conf
@@ -10,7 +10,44 @@ server {
 
 	add_header Onion-Location "http://paske4urhs6nttrtlkuwa5cowum3fjkc6yv6kl4ncx3mjxcd77764nqd.onion$request_uri" always;
 
-	include custom.d/sites/cleberg_net_static_locations.conf;
+    location /org/ {
+            internal;
+            alias /var/www/cleberg.net/org/;
+            default_type text/markdown;
+            add_header Content-Type "text/markdown; charset=utf-8" always;
+            add_header Vary "Accept" always;
+    }
+
+    location = / {
+            if ($http_accept ~* "text/markdown") {
+                    rewrite ^/$ /org/index.org last;
+            }
+
+            add_header Vary "Accept" always;
+            try_files /index.html =404;
+    }
+
+    location / {
+            try_files $uri $uri/ =404;
+    }
+
+    location /blog/ {
+            rewrite ^/blog/((?!index)[^/]+)/(.*)$ /blog/$1.html permanent;
+            if ($http_accept ~* "text/markdown") {
+                    rewrite ^/blog/([^/]+)\.html$ /org/blog/$1.org last;
+            }
+    }
+
+    location ~ ^/(.+)\.html$ {
+            if ($http_accept ~* "text/markdown") {
+                    rewrite ^/(.+)\.html$ /org/$1.org last;
+            }
+            add_header Vary "Accept" always;
+            try_files $uri =404;
+    }
+
+    location /atom.xml { return 301 $scheme://$host/feed.xml; }
+    location /blog/salary-transparency.html { return 301 $scheme://$host/salary/; }
 }
 
 server {
diff --git a/linux/nginx/etc/nginx/custom.d/sites/cleberg_net_static_locations.conf b/linux/nginx/etc/nginx/custom.d/sites/cleberg_net_static_locations.conf
index b8764b3..2ece0d1 100644
--- a/linux/nginx/etc/nginx/custom.d/sites/cleberg_net_static_locations.conf
+++ b/linux/nginx/etc/nginx/custom.d/sites/cleberg_net_static_locations.conf
@@ -1,8 +1,18 @@
 location /org/ {
 	internal;
 	alias /var/www/cleberg.net/org/;
-	default_type text/plain;
-	add_header Content-Type "text/plain; charset=utf-8";
+	default_type text/markdown;
+	add_header Content-Type "text/markdown; charset=utf-8" always;
+	add_header Vary "Accept" always;
+}
+
+location = / {
+	if ($http_accept ~* "text/markdown") {
+		rewrite ^/$ /org/index.org last;
+	}
+
+	add_header Vary "Accept" always;
+	try_files /index.html =404;
 }
 
 location / {
@@ -16,10 +26,11 @@ location /blog/ {
 	}
 }
 
-location ~ ^/([^/]+)\.html$ {
+location ~ ^/(.+)\.html$ {
 	if ($http_accept ~* "text/markdown") {
-		rewrite ^/([^/]+)\.html$ /org/$1.org last;
+		rewrite ^/(.+)\.html$ /org/$1.org last;
 	}
+	add_header Vary "Accept" always;
 	try_files $uri =404;
 }