The changes are to add the following function in includes/joomla.php
Code:
/**
* @param string The value of the name attibute
* @param string The value of the content attibute to append to the existing
* Replaces the corresponding Meta Tag with the new contents
*/
function replaceMetaTag( $name, $content ) {
$name = trim( htmlspecialchars( $name ) );
$n = count( $this->_head['meta'] );
for ($i = 0; $i < $n; $i++) {
if ($this->_head['meta'][$i][0] == $name) {
$content = trim( htmlspecialchars( $content ) );
$this->_head['meta'][$i][1] = $content ;
return;
}
}
$this->addMetaTag( $name , $content );
}
in includes/frontend.php, inside the function mosShowHead you find the two lines below that append the comments
$mainframe->appendMetaTag( 'description', $mosConfig_MetaDesc );
$mainframe->appendMetaTag( 'keywords', $mosConfig_MetaKeys );
[
These two lines you comment and below you paste the following code block
Code:
if ($option == 'com_frontpage') {
$mainframe->replaceMetaTag( 'description', $mosConfig_MetaDesc );
$mainframe->replaceMetaTag( 'keywords', $mosConfig_MetaKeys );
}
The problem is that mosShowHead is called last and if we are not on the front page the content meta tags are overwritten with the site meta tags if it were not for the replacemetatag calls beeing inside of an if block
Final change. This in components/com_content/content.html.php inside function show, do the following change
Code:
//$mainframe->appendMetaTag( 'description', $row->metadesc );
//$mainframe->appendMetaTag( 'keywords', $row->metakey );
$mainframe->replaceMetaTag( 'description', $row->metadesc );
$mainframe->replaceMetaTag( 'keywords', $row->metakey );
Lesezeichen