Move redirects to a Nix list
Move redirects to a Nix list and generate them using a `for` loop for better maintainability.
This commit is contained in:
parent
ae61e41caa
commit
c6fa8493df
3 changed files with 3083 additions and 776 deletions
|
@ -28,6 +28,12 @@
|
|||
}
|
||||
'') tomePaths
|
||||
);
|
||||
|
||||
redirects = import ./www.oliverdavies.uk-redirects.nix;
|
||||
|
||||
redirectLines = builtins.concatStringsSep "\n" (
|
||||
map (r: "redir ${r.from} ${r.to} permanent") redirects
|
||||
);
|
||||
in
|
||||
''
|
||||
encode gzip
|
||||
|
@ -44,8 +50,17 @@
|
|||
}
|
||||
|
||||
${tomeConfig}
|
||||
''
|
||||
+ builtins.readFile ./www.oliverdavies.uk-redirects.caddy;
|
||||
|
||||
@articles path_regexp ^/articles/(.*)$
|
||||
@talks path_regexp ^/talks/(.*)$
|
||||
@talks-archive path_regexp ^/talks/archive/(.*)$
|
||||
|
||||
redir @articles /blog/{re.1} permanent
|
||||
redir @talks-archive /presentations/{re.1} permanent
|
||||
redir @talks /presentations/{re.1} permanent
|
||||
|
||||
${redirectLines}
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue