Open graph tag generation for posts
This commit is contained in:
parent
585b2be5ab
commit
2862f45d77
5 changed files with 40 additions and 26 deletions
|
@ -7,17 +7,18 @@ use Render::Util;
|
|||
use DB::BlogMeta;
|
||||
|
||||
sub generate-head(BlogMeta:D $meta, $title?, $description?) is export {
|
||||
head [
|
||||
my $final-title = do if $title ~~ Str:D {
|
||||
"$title — {$meta.title}"
|
||||
} else {
|
||||
$meta.title
|
||||
};
|
||||
[
|
||||
meta :charset<utf-8>;
|
||||
meta :name<viewport>, :content<width=device-width, initial-scale=1>;
|
||||
meta :author :content<Nathan McCarty>;
|
||||
do if $title ~~ Str:D {
|
||||
title "$title — {$meta.title}";
|
||||
} else {
|
||||
title $meta.title;
|
||||
}
|
||||
title $final-title;
|
||||
# Add description, if one exists
|
||||
optl $description ~~ Str:D, -> {meta :description :content($description)};
|
||||
optl $description ~~ Str:D, -> {meta :description :content(^ $description)};
|
||||
# Preconnect to all our resource sources
|
||||
link :rel<preconnect> :href<https://static.stranger.systems>;
|
||||
link :rel<preconnect> :href<https://fonts.googleapis.com>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue