diff options
author | Vincent Ambo <tazjin@google.com> | 2020-02-09T21·44+0000 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-02-09T21·44+0000 |
commit | 1e770f5d8844b01817247d6027b39eec6b4b46f8 (patch) | |
tree | 677dee5015d5ca6a6434db9991fa2bbd3d497f66 /web/blog/default.nix | |
parent | 0bc2f8995eb6ebcd13a33282520f724451630a36 (diff) |
feat(web/blog): Add support for draft & unlisted posts r/521
Posts with either `draft = true;` or `listed = false;` will no longer be included in index generation and will have a warning callout inserted at the top of the page urging people not to share the links to them.
Diffstat (limited to 'web/blog/default.nix')
-rw-r--r-- | web/blog/default.nix | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/web/blog/default.nix b/web/blog/default.nix index 73b1bc20e3e7..5f97c00bc985 100644 --- a/web/blog/default.nix +++ b/web/blog/default.nix @@ -7,6 +7,8 @@ with pkgs.nix.yants; let + inherit (builtins) filter; + # Type definition for a single blog post. post = struct "blog-post" { key = string; # @@ -38,7 +40,12 @@ let "cp ${fragments.renderPost post} $out/${post.key}.html" ) posts)} ''; + + includePost = post: !(fragments.isDraft post) && !(fragments.isUnlisted post); in { - inherit post posts rendered; + inherit post rendered; static = ./static; + + # Only include listed posts + posts = filter includePost posts; } |