Hallo ich nutze folgenden COde in den news- und event-Templates
PHP-Code:
$GLOBALS['TL_HEAD'][] = '<meta property="og:locale" content="de_DE" />';
$GLOBALS['TL_HEAD'][] = '<meta property="og:title" content="'.$this->newsHeadline.'" />';
$GLOBALS['TL_HEAD'][] = '<meta property="og:type" content="article" />';
$GLOBALS['TL_HEAD'][] = '<meta property="og:description" content="'.strip_tags($this->teaser).'" />';
$GLOBALS['TL_HEAD'][] = '<meta property="og:url" content="' .$this->replaceInsertTags( '{{env::path}}{{env::request}}' ). '" />';
$GLOBALS['TL_HEAD'][] = '<meta property="og:site_name" content="' .$this->replaceInsertTags( '{{page::rootTitle}}' ). '" />';
$ogimage = $this->getImage( $this->urlEncode( $this->singleSRC ), 200, 200 , 'box' );
$GLOBALS['TL_HEAD'][] = '<meta property="og:image" content="'.$this->Environment->base . $ogimage.'" />';
Das funktioniert soweit, aber ich habe das Problem das nicht NUR das Bild aus dem Teaser oder dem Text der News bzw. Events als Meta-Tag ausgegeben wird sondern noch weitere aus vorhergendenen News/Events!
Bsp.:
HTML-Code:
<meta property="og:image" content="http://www.muster.de/files/pictures/ALT_1.jpg">
<meta property="og:image" content="http://www.muster.de/files/pictures/ALT_2.jpg">
<meta property="og:image" content="http://www.muster.de/files/pictures/ALT_3.jpg">
<meta property="og:image" content="http://www.muster.de/files/pictures/ALT_4.jpg">
<meta property="og:image" content="http://www.muster.de/files/pictures/ALT_5.jpg">
<meta property="og:image" content="http://www.muster.de/files/pictures/AKTUELL.jpg">
Ich habe versucht zu schauen ob ich das $GLOBALS vorab einmal leeren kann nach dem Motto:
PHP-Code:
unset(array_search('property="og:image', $GLOBALS));
das hat aber nicht geklappt.
Hat jemand eine Idee woran das liegt und wie ich das verhindern/beheben kann?
Dadurch wird oftmals das falsche Bild zum Teilen genommen, was natürlich so nicht gewünscht ist!
Grüße
Kevin
Lesezeichen