From: Mischa POSLAWSKY Date: Tue, 19 Dec 2023 18:13:39 +0000 (+0100) Subject: common: format page attribute "image" as og header X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/f3267a45a926414f2b97855ec4ea76e04f22e09f common: format page attribute "image" as og header Shared code to ascertain absolute urls. --- diff --git a/common.inc.plp b/common.inc.plp index 2976cbe..6295de7 100644 --- a/common.inc.plp +++ b/common.inc.plp @@ -147,6 +147,14 @@ sub Html { '', ); + if (my $img = $meta->{image}) { + my $proto = sprintf('http%s://', !!$ENV{HTTPS} && 's'); + my $url = "$proto$ENV{HTTP_HOST}/$img"; + push @{ $meta->{raw} }, ( + qq(), + ); + } + my ($file) = $ENV{SCRIPT_FILENAME} =~ m{ ([^/]+) \.plp$ }x; PLP_START { diff --git a/dieren.plp b/dieren.plp index f7935fe..03d0dc9 100644 --- a/dieren.plp +++ b/dieren.plp @@ -32,9 +32,6 @@ $Request ||= 'standaard'; my $pageinfo = $subpages{$Request} or Html(), Abort("Onbekende dierenpagina $Request", '404 request not found'); -my $proto = sprintf('http%s://', !!$ENV{HTTPS} && 's'); -my $preview = "$proto$ENV{HTTP_HOST}/dieren.jpg"; - Html({ title => $pageinfo->{title}.' cheat sheet', version => '1.1', @@ -45,8 +42,8 @@ Html({ relatie vernoemd vernoeming combinatie samenstelling voorvoegsel onverwant land zee lucht animals dutch language '], + image => 'dieren.jpg', raw => <<"EOT", -