Canonical URL

This commit is contained in:
Diego Najar 2019-01-19 21:05:38 +01:00
parent fd29f1ce11
commit 8b17ba7a09
3 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,7 @@
{
"plugin-data":
{
"name": "Canonical",
"description": ""
}
}

View File

@ -0,0 +1,10 @@
{
"author": "Bludit",
"email": "",
"website": "https://plugins.bludit.com",
"version": "3.6.1",
"releaseDate": "2019-01-16",
"license": "MIT",
"compatible": "3.6.1",
"notes": ""
}

View File

@ -0,0 +1,15 @@
<?php
class pluginCanonical extends Plugin {
public function siteHead()
{
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;
}
}
}