head: title as og:name property, clean up description
authorMischa POSLAWSKY <perl@shiar.org>
Sun, 17 May 2020 04:23:23 +0000 (06:23 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Sat, 5 Dec 2020 00:41:21 +0000 (01:41 +0100)
Satisfy automated SEO warnings about missing title (wanting an explicit tag)
and recommended summary length (fitting some long paragraphs by omitting
inconsequential spaces).

head.inc.php

index 2b29afc41a6e135ba7b45b2540b017cb517264af..34e0d0439032701a721e7d7ee40de6abfe82d46e 100644 (file)
@@ -3,10 +3,10 @@
 <head>
        <meta charset="utf-8" />
 <?php if ($Article->title) { ?>
-       <title><?= htmlspecialchars($Article->safetitle) ?></title>
+       <title property="og:name"><?= htmlspecialchars($Article->safetitle) ?></title>
 <?php } ?>
 <?php if ($Article->teaser) { ?>
-       <meta name="description" property="og:description" content="<?= strip_tags($Article->teaser) ?>" />
+       <meta name="description" property="og:description" content="<?= preg_replace('/\s+/', ' ', strip_tags($Article->teaser)) ?>" />
 <?php } ?>
        <meta name="viewport" content="width=device-width" />
        <!--[if lt IE 9]><script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.min.js"></script><![endif]-->