common: prepare stylesheet links early to fix cookies
authorMischa POSLAWSKY <perl@shiar.org>
Sat, 22 Apr 2017 11:49:12 +0000 (13:49 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Thu, 25 May 2017 20:13:05 +0000 (22:13 +0200)
Broken in commit v1.9-29-g8c3e7dc648 (2017-04-10)
[common: join stylesheets html inline].

common.inc.plp

index bfeb2449fc652a29d718e43595899d72e0cfc8bd..7935a8e4a31c158c6e42ce425a90700c23351dc1 100644 (file)
@@ -105,6 +105,10 @@ sub Html {
        ref $_ eq 'ARRAY' or $_ = [$_]
                for grep {$_} $meta->{raw}, $meta->{description}, $meta->{keywords};
 
+       # document headers before output
+       $header{content_type} = "text/html; charset=$meta->{charset}";
+       unshift @{ $meta->{raw} }, stylesheet($meta->{stylesheet});
+
        # optional amends
        push @{ $meta->{raw} }, (
                '<!--[if lte IE 6]><style> .help dl.legend dt {margin:0 0 1px} </style><![endif]-->',
@@ -116,7 +120,6 @@ sub Html {
        ) if $meta->{keys};
 
        # leading output
-       $header{content_type} = "text/html; charset=$meta->{charset}";
        say '<!DOCTYPE html>';
        say '<html lang="en">';
        say '';
@@ -129,7 +132,6 @@ sub Html {
                for join(', ', @{ $meta->{keywords} }) || ();
        say '<meta name="viewport" content="width=device-width, initial-scale=1">';
        say '<link rel="icon" type="image/png" href="/clip.png">';
-       say for stylesheet($meta->{stylesheet});
        say for map { @{$_} } $meta->{raw} || ();
        say '<meta name="robots" content="noindex">' if $Dev;
        say '</head>';