keyboard/altgr: automatically generate thumbnails from source images
[sheet.git] / common.inc.plp
index 6295de7ef2ad0653fc436d9636831349742ee832..0754d85acf7c8f8bfafd56f245691e0085678ed0 100644 (file)
@@ -106,7 +106,7 @@ sub Data {
                local $/; # slurp
                return JSON::decode_json(readline $cache);
        };
-       if ($! or $@ or !@data or !$data[0]) {
+       if ($@ or !@data or !$data[0]) {
                die ['Table data not found', $@ || $!];
        }
        if (@data == 1 and ref $data[0] eq 'HASH' and not %{$data[0]}) {
@@ -157,6 +157,11 @@ sub Html {
 
        my ($file) = $ENV{SCRIPT_FILENAME} =~ m{ ([^/]+) \.plp$ }x;
 
+       if (my $url = $meta->{canonical} // "/$file/$Request") {
+               $url = "https://sheet.shiar.nl$url";
+               push @{ $meta->{raw} }, qq(<link rel="canonical" href="$url" />);
+       }
+
        PLP_START {
                # leading output
                say '<!DOCTYPE html>';