2021-10-19 14:00:51 +02:00
|
|
|
{ depot, lib, pkgs, ... }:
|
2020-02-08 14:33:13 +01:00
|
|
|
|
2020-02-21 13:47:29 +01:00
|
|
|
with depot.nix.yants;
|
2020-02-08 14:33:13 +01:00
|
|
|
|
|
|
|
let
|
2021-10-19 14:00:51 +02:00
|
|
|
inherit (builtins) hasAttr filter;
|
2021-11-02 14:34:20 +01:00
|
|
|
|
2021-11-05 14:19:06 +01:00
|
|
|
config = {
|
2021-11-02 14:34:20 +01:00
|
|
|
name = "tazjin's blog";
|
2021-11-05 14:19:06 +01:00
|
|
|
baseUrl = "https://tazj.in/blog";
|
2021-11-02 14:34:20 +01:00
|
|
|
|
|
|
|
footer = ''
|
|
|
|
<p class="footer">
|
|
|
|
<a class="uncoloured-link" href="https://tazj.in">homepage</a>
|
|
|
|
|
|
|
|
|
<a class="uncoloured-link" href="https://cs.tvl.fyi/">code</a>
|
|
|
|
</p>
|
|
|
|
<p class="lod">ಠ_ಠ</p>
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2021-10-19 14:00:51 +02:00
|
|
|
inherit (depot.web.blog) post includePost renderPost;
|
2020-02-09 22:44:48 +01:00
|
|
|
|
2021-10-19 14:00:51 +02:00
|
|
|
posts = filter includePost (list post (import ./posts.nix));
|
2020-02-08 14:33:13 +01:00
|
|
|
|
2022-01-30 17:06:58 +01:00
|
|
|
rendered = pkgs.runCommandNoCC "tazjins-blog" { } ''
|
2020-02-08 14:33:13 +01:00
|
|
|
mkdir -p $out
|
|
|
|
|
|
|
|
${lib.concatStringsSep "\n" (map (post:
|
2021-11-05 14:19:06 +01:00
|
|
|
"cp ${renderPost config post} $out/${post.key}.html"
|
2020-02-08 14:33:13 +01:00
|
|
|
) posts)}
|
2020-02-08 14:47:47 +01:00
|
|
|
'';
|
2020-02-09 22:44:48 +01:00
|
|
|
|
2022-01-30 17:06:58 +01:00
|
|
|
in
|
|
|
|
{
|
2021-11-05 14:19:06 +01:00
|
|
|
inherit posts rendered config;
|
2020-02-11 20:31:20 +01:00
|
|
|
|
|
|
|
# Generate embeddable nginx configuration for redirects from old post URLs
|
2022-01-30 17:06:58 +01:00
|
|
|
oldRedirects = lib.concatStringsSep "\n" (map
|
|
|
|
(post: ''
|
|
|
|
location ~* ^(/en)?/${post.oldKey} {
|
|
|
|
return 301 https://tazj.in/blog/${post.key};
|
|
|
|
}
|
|
|
|
'')
|
|
|
|
(filter (hasAttr "oldKey") posts));
|
2020-02-08 15:06:57 +01:00
|
|
|
}
|