[Plugin] Canonical - added support fot category and tags URLs. Added Czech language
This commit is contained in:
parent
e4569677c4
commit
f50df101eb
4 changed files with 50 additions and 9 deletions
8
bl-plugins/canonical/languages/cs_CZ.json
Normal file
8
bl-plugins/canonical/languages/cs_CZ.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Canonical",
|
||||
"description": "Použitím kanonických URL adres informujete vyhledávače o adresách s identickým obsahem"
|
||||
},
|
||||
"this-plugin-has-no-settings": "Tento plugin nemá nastavení"
|
||||
}
|
|
@ -3,5 +3,6 @@
|
|||
{
|
||||
"name": "Canonical",
|
||||
"description": "Using canonical URLs can help to inform search engines which URLs have identical content."
|
||||
}
|
||||
}
|
||||
},
|
||||
"this-plugin-has-no-settings": "This plugin has no settings"
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "4.0.0",
|
||||
"releaseDate": "2021-05-23",
|
||||
"releaseDate": "2022-09-30",
|
||||
"license": "MIT",
|
||||
"compatible": "4.0.0",
|
||||
"notes": ""
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,11 +3,43 @@
|
|||
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') {
|
||||
|
||||
$html = '<!-- Plugin Canonical -->' . PHP_EOL;
|
||||
|
||||
if ($GLOBALS['WHERE_AM_I'] === 'home')
|
||||
{
|
||||
$html .= '<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;
|
||||
$html .= '<link rel="canonical" href="'.$page->permalink().'">'.PHP_EOL;
|
||||
|
||||
} elseif ($GLOBALS['WHERE_AM_I'] === 'category')
|
||||
{
|
||||
global $url;
|
||||
$categoryKey = $url->slug();
|
||||
$category = new Category( $categoryKey );
|
||||
|
||||
$html .= '<link rel="canonical" href="' . $category->permalink() . '">'.PHP_EOL;
|
||||
|
||||
} elseif ($GLOBALS['WHERE_AM_I'] === 'tag')
|
||||
{
|
||||
global $url;
|
||||
$tagKey = $url->slug();
|
||||
$tag = new Tag( $tagKey );
|
||||
|
||||
$html .= '<link rel="canonical" href="'.$tag->permalink().'">'.PHP_EOL;
|
||||
|
||||
}
|
||||
$html .= '<!-- /Plugin Canonical -->' . PHP_EOL;
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
|
||||
public function form()
|
||||
{
|
||||
global $L;
|
||||
|
||||
return '<div class="alert alert-info">' . $L->g('This plugin has no settings') . '</div>';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue