factor out post-link method
This commit is contained in:
parent
68e20af5d7
commit
72bd2a238c
2 changed files with 16 additions and 14 deletions
|
@ -3,6 +3,7 @@ use v6.e.PREVIEW;
|
|||
use HTML::Functional;
|
||||
|
||||
use Render::Head;
|
||||
use Render::Util;
|
||||
use DB::BlogMeta;
|
||||
use DB::Post;
|
||||
|
||||
|
@ -194,13 +195,7 @@ method generate-post(Post:D $post, BlogMeta:D $meta) {
|
|||
method generate-blurb(Int:D $id, $db) {
|
||||
my $post = $db.posts{$id};
|
||||
my $desc = $post.description;
|
||||
my @slugs = $post.all-slugs;
|
||||
# Use the primary slug if there is one, the id if there isn't
|
||||
my $link = do if @slugs.elems {
|
||||
"/posts/by-slug/{@slugs[*-1]}.html"
|
||||
} else {
|
||||
"/posts/by-id/$id.html"
|
||||
}
|
||||
my $link = post-link $id, $post;
|
||||
div :class<post-blurb>, [
|
||||
div :class<post-blurb-title>, [
|
||||
a :href($link), span [
|
||||
|
@ -272,13 +267,7 @@ method generate-archive($db) {
|
|||
method generate-tag-blurb($db, $tag, $limit?) {
|
||||
sub post-to-link($id, $post) {
|
||||
my $desc = $post.description;
|
||||
my @slugs = $post.all-slugs;
|
||||
# Use the primary slug if there is one, the id if there isn't
|
||||
my $link = do if @slugs.elems {
|
||||
"/posts/by-slug/{@slugs[*-1]}.html"
|
||||
} else {
|
||||
"/posts/by-id/$id.html"
|
||||
}
|
||||
my $link = post-link $id, $post;
|
||||
div :class<tag-blurb-post>, [
|
||||
div :class<tag-blurb-post-title>, [
|
||||
a :href($link), span [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue