From b5c50f4699ad5dd18b247b77719aa188b0003430 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Tue, 11 Feb 2020 19:31:20 +0000 Subject: refactor(web): Let //web/ derivations build static pages only Removes nginx configuration built by the web targets (with the exception of the includable block used to set up redirects for old blog URLs). --- web/blog/default.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'web/blog') diff --git a/web/blog/default.nix b/web/blog/default.nix index 5f97c00bc985..a8e48a9d6888 100644 --- a/web/blog/default.nix +++ b/web/blog/default.nix @@ -7,7 +7,7 @@ with pkgs.nix.yants; let - inherit (builtins) filter; + inherit (builtins) filter hasAttr map; # Type definition for a single blog post. post = struct "blog-post" { @@ -48,4 +48,12 @@ in { # Only include listed posts posts = filter includePost posts; + + # Generate embeddable nginx configuration for redirects from old post URLs + oldRedirects = lib.concatStringsSep "\n" (map (post: '' + location ~* ^(/en)?/${post.oldKey} { + # TODO(tazjin): 301 once this works + return 302 https://tazj.in/blog/${post.key}; + } + '') (filter (hasAttr "oldKey") posts)); } -- cgit 1.4.1