diff options
author | Vincent Ambo <tazjin@google.com> | 2020-02-11T19·31+0000 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-02-11T19·31+0000 |
commit | b5c50f4699ad5dd18b247b77719aa188b0003430 (patch) | |
tree | 99c61b3c4b1876d8f3fde79f3e7e1b042fa92e2a /web/blog | |
parent | 2e958227122717ae5a013fd4656664d28d20f00d (diff) |
refactor(web): Let //web/ derivations build static pages only r/539
Removes nginx configuration built by the web targets (with the exception of the includable block used to set up redirects for old blog URLs).
Diffstat (limited to 'web/blog')
-rw-r--r-- | web/blog/default.nix | 10 |
1 files changed, 9 insertions, 1 deletions
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)); } |