Special post handling

This commit is contained in:
Nathan McCarty 2025-03-15 16:15:15 -04:00
parent c0780047bf
commit 3d2d1f897e
9 changed files with 24 additions and 5 deletions

View file

@ -51,10 +51,20 @@ initComments(\{
body [
site-header $meta;
article :class<post>, [
post-header $id, $post, $db;
div :class<post-body>, [
$content;
];
# Only generate the post header if the post isn't special
optl !$post.special, -> {post-header $id, $post, $db};
# If the post is special, wrap it in a special div
do if $post.special {
div :class<special-post>, [
div :class<post-body>, [
$content;
];
];
} else {
div :class<post-body>, [
$content;
];
}
];
# Only actually have the comment section if the post isn't hidden
optl !$post.hidden, -> {div :id<comment-section>, :class<comments>};

View file

@ -43,6 +43,8 @@ has Str:D @.tags is rw is json = [];
has Bool:D $.hidden is json is rw = False;
#| An optional link to the source code for the post
has Str $.source-code is rw is json;
#| Special posts follow different rendering rules
has Bool:D $.special is json is rw = False;
#| Get the title for this post, intended to be extracted from whatever
#| document produced it