head: include canonical location in og:url
authorMischa POSLAWSKY <perl@shiar.org>
Sun, 17 May 2020 00:03:52 +0000 (02:03 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Sun, 17 May 2020 00:12:48 +0000 (02:12 +0200)
Does not (yet) account for all aliases, but at least provides a good
reference to the requested page.

article.inc.php
head.inc.php

index 53102bac4065b11ec7630897329e131561ce551d..dd3d5b2996d777fafe929c593dd666b5c97a5033 100644 (file)
@@ -22,7 +22,7 @@ class ArchiveArticle
        function __construct($path)
        {
                $this->page = preg_replace('{^\.(?:/|$)}', '', $path);
-               $this->link = preg_replace('{(?:/index)?\.html$}', '', $this->page);
+               $this->link = preg_replace('{(?:(?:/|^)index)?\.html$}', '', $this->page);
                $this->raw($this->page);
        }
 
index 72cbf36024f721ef6b92fb669094b48ab98ac25e..797f611a0c5cb0a15db2592df9d4e7dfde48abeb 100644 (file)
@@ -13,5 +13,6 @@
 <?php if ($Article->image) { ?>
        <meta property="og:image" content="https://<?= $_SERVER['HTTP_HOST'] . '/' . htmlspecialchars($Article->thumb('640x')) ?>" />
 <?php } ?>
+       <meta property="og:url" content="https://<?= $_SERVER['HTTP_HOST'] . '/' . htmlspecialchars($Article->link) ?>" />
 </head>
 <body>