Initial tags support

This commit is contained in:
Nathan McCarty 2025-02-06 23:45:26 -05:00
parent f8c575caac
commit f1515aab06
2 changed files with 36 additions and 1 deletions

View file

@ -149,12 +149,41 @@ method post-read-time(Post:D $post) {
]
}
method post-tag(Str:D $tag) {
span :class<post-tag>, [
a :href("/tags/$tag.html"), [
icon 'hash';
$tag;
]
]
}
method post-tags(Post:D $post){
sub intersperse (\element, +list) {
gather for list {
FIRST .take, next;
take slip element, $_;
}
}
my @tags = $post.tags;
if @tags {
@tags.=map(-> $tag {self.post-tag($tag)});
div :class<post-tags>, [
icon 'purchase-tag';
'&nbsp;';
intersperse(', ', @tags);
]
} else {
[]
}
}
method post-info(Post:D $post) {
div :class<post-info>, [
self.post-date: $post;
self.post-edit: $post;
self.post-read-time: $post;
# TODO: Add tags once we have support for that
self.post-tags: $post;
];
}