feat(web/blog): Add support for draft & unlisted posts
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.
This commit is contained in:
parent
0bc2f8995e
commit
1e770f5d88
2 changed files with 39 additions and 8 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue