075 optimisation méta d'un article de blog

This commit is contained in:
Fred Tempez 2020-04-28 15:06:49 +02:00
parent e1e625b361
commit 3c45d77023

View File

@ -36,7 +36,7 @@ class common {
const THUMBS_WIDTH = 640;
// Numéro de version
const ZWII_VERSION = '10.0.073';
const ZWII_VERSION = '10.0.075';
const ZWII_UPDATE_CHANNEL = "v10";
public static $actions = [];
@ -1541,7 +1541,10 @@ class core extends common {
$moduleId = $this->getData(['page', $this->getUrl(0), 'moduleId']);
$this->addOutput([
'title' => $title,
'metaDescription' => $this->getData(['page', $this->getUrl(0), 'metaDescription']),
// Meta description = 160 premiers caractères de l'article
'metaDescription' => $this->getData(['page',$this->getUrl(0),'moduleId']) === 'blog' && !empty($this->getUrl(1))
? substr($this->getData(['module',$this->getUrl(0),$this->getUrl(1),'content']) ,0,159)
: $this->getData(['page', $this->getUrl(0), 'metaDescription']),
'metaTitle' => $this->getData(['page', $this->getUrl(0), 'metaTitle']),
'typeMenu' => $this->getData(['page', $this->getUrl(0), 'typeMenu']),
'iconUrl' => $this->getData(['page', $this->getUrl(0), 'iconUrl']),
@ -2249,8 +2252,8 @@ class layout extends common {
* Affiche la meta description
*/
public function showMetaDescription() {
echo '<meta name="description" content="' . $this->core->output['metaDescription'] . '" />';
echo '<meta property="og:description" content="' . $this->core->output['metaDescription'] . '" />';
echo '<meta name="description" content="' . $this->core->output['metaDescription'] . '" />';
echo '<meta property="og:description" content="' . $this->core->output['metaDescription'] . '" />';
}
/**