koblog/bl-plugins/canonical/plugin.php

13 lines
337 B
PHP
Raw Normal View History

2019-01-19 21:05:38 +01:00
<?php
class pluginCanonical extends Plugin {
2021-09-25 20:28:17 +02:00
public function siteHead() {
2019-01-19 21:05:38 +01:00
if ($GLOBALS['WHERE_AM_I'] === 'home') {
return '<link rel="canonical" href="'.DOMAIN_BASE.'"/>'.PHP_EOL;
} elseif ($GLOBALS['WHERE_AM_I'] === 'page') {
global $page;
return '<link rel="canonical" href="'.$page->permalink().'"/>'.PHP_EOL;
}
}
}