From f497d0dfe2ecba556dfb242f19b4be9ca616663b Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Fri, 26 Jul 2024 12:08:18 -0500 Subject: [PATCH] feat(host/luna): strip `.html` extension for blog --- hosts/luna/modules/services/nginx.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hosts/luna/modules/services/nginx.nix b/hosts/luna/modules/services/nginx.nix index 651b8b84..624b4c82 100644 --- a/hosts/luna/modules/services/nginx.nix +++ b/hosts/luna/modules/services/nginx.nix @@ -22,6 +22,12 @@ forceSSL = true; enableACME = true; root = inputs.blog.packages.${pkgs.system}.default; + locations."/".extraConfig = '' + if ($request_uri ~ ^/(.*)\.html(\?|$)) { + return 302 /$1; + } + try_files $uri $uri.html $uri/ =404; + ''; locations."/".index = "home.html"; }; }