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
1 changed files with 8 additions and 5 deletions

View File

@ -36,7 +36,7 @@ class common {
const THUMBS_WIDTH = 640; const THUMBS_WIDTH = 640;
// Numéro de version // Numéro de version
const ZWII_VERSION = '10.0.073'; const ZWII_VERSION = '10.0.075';
const ZWII_UPDATE_CHANNEL = "v10"; const ZWII_UPDATE_CHANNEL = "v10";
public static $actions = []; public static $actions = [];
@ -1535,13 +1535,16 @@ class core extends common {
} }
// Importe le module // Importe le module
else { else {
// Id du module, et valeurs en sortie de la page si il s'agit d'un module de page // Id du module, et valeurs en sortie de la page si il s'agit d'un module de page
if($access AND $this->getData(['page', $this->getUrl(0), 'moduleId'])) { if($access AND $this->getData(['page', $this->getUrl(0), 'moduleId'])) {
$moduleId = $this->getData(['page', $this->getUrl(0), 'moduleId']); $moduleId = $this->getData(['page', $this->getUrl(0), 'moduleId']);
$this->addOutput([ $this->addOutput([
'title' => $title, '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']), 'metaTitle' => $this->getData(['page', $this->getUrl(0), 'metaTitle']),
'typeMenu' => $this->getData(['page', $this->getUrl(0), 'typeMenu']), 'typeMenu' => $this->getData(['page', $this->getUrl(0), 'typeMenu']),
'iconUrl' => $this->getData(['page', $this->getUrl(0), 'iconUrl']), 'iconUrl' => $this->getData(['page', $this->getUrl(0), 'iconUrl']),
@ -2249,8 +2252,8 @@ class layout extends common {
* Affiche la meta description * Affiche la meta description
*/ */
public function showMetaDescription() { public function showMetaDescription() {
echo '<meta name="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'] . '" />'; echo '<meta property="og:description" content="' . $this->core->output['metaDescription'] . '" />';
} }
/** /**