diff --git a/lib/Atom.rakumod b/lib/Atom.rakumod index 0c0ad7b..0efd238 100644 --- a/lib/Atom.rakumod +++ b/lib/Atom.rakumod @@ -41,6 +41,12 @@ sub post-to-item(BlogMeta:D $meta, Int:D $id, Post:D $post --> XML::Element) { XML::Element.new(:name, :attribs({:href($link), :rel})); $xml.append: XML::Element.new(:name, :nodes([$desc])) if $desc; + if $post.tags { + for $post.tags -> $tag { + $xml.append: + XML::Element.new(:name, :attribs({:term($tag)})); + } + } $xml } diff --git a/lib/Config.rakumod b/lib/Config.rakumod index 5e043fc..85cab41 100644 --- a/lib/Config.rakumod +++ b/lib/Config.rakumod @@ -149,12 +149,41 @@ method post-read-time(Post:D $post) { ] } +method post-tag(Str:D $tag) { + span :class, [ + 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, [ + icon 'purchase-tag'; + ' '; + intersperse(', ', @tags); + ] + } else { + [] + } +} + method post-info(Post:D $post) { div :class, [ 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; ]; }