Initial tags support
This commit is contained in:
parent
f8c575caac
commit
f1515aab06
2 changed files with 36 additions and 1 deletions
|
@ -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';
|
||||
' ';
|
||||
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;
|
||||
];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue