Javier
Javier

Reputation: 1

Remove Meta Description in Joomla 1.5 Without Changing Core

Does anybody know how can I remove the meta tag description without changing Joomla core. I found that addingup $this->setDescription(null); in my template it would work but this just leave the tag empty. I'd like to take this off at all.

I have spent the whole afternoon researching but it seems like changing core is the only option, however I'm not comfortable with this option since a future upgrade may overwrite my changes.

Thanks in advance!

Upvotes: 0

Views: 921

Answers (3)

Kiran Cheema
Kiran Cheema

Reputation: 66

Also the other way (without hacking the component.php) is to create a new tmpl file in the template folder i.e:

[path to install]/template/mytemplate/

in that folder there will be Index.php and component.php you can create another one e.g. blank.php and specify the headers you want here

with <jdoc:include type="component" />

call it with ?tmpl=blank

Upvotes: 1

Kiran Cheema
Kiran Cheema

Reputation: 21

in templates/mytemplate/ component.php /index.php remove the following :

<jdoc:include type="head" />

this will remove all elements

however it will also remove all js & css files which is not cool! so what i would do is this:

to access all the head elements as an array: $document = $this->getHeadData();

to access path ref: $baseURL=JURI::base(true);

to grab all scripts (inc all loaded with addScript()method) :

foreach ($document[scripts] as $key=>$value){
if (stristr($key,$baseURL)==NULL){$url= $baseURL."/".$key ;}else{$url=$key;}
$scripts .= "<script type=".$value." src=".$url."></script>";
};

to grab all stylesheets (inc all loaded with addStyleSheet()method):

foreach ($document[styleSheets] as $key=>$value){
if (stristr($key,$baseURL)==NULL){$url= $baseURL."/".$key ;}else{$url=$key;}
$style .= "<link rel='stylesheet' type=".$value[mime]." href=".$url." />";
};

to grab all internal script elements (e.g. added with addScriptDeclaration or JFactory::getEditor) use this with the script method:

foreach ($document[script] as $key=>$value){
 $scripts .= "<script type=".$key." >".$value."</script>";
}

to grab all custom scripts (e.g. editor initialization params) :

foreach ($document[custom] as $value){
$custom .= $value;
}

finally echo the statements in the <head> :

<?
echo $style;
Echo $scripts;
echo $custom;
?>

Upvotes: 2

Brent Friar
Brent Friar

Reputation: 10609

This can be done with a plugin. There isn't one that removes the tag entirely that I know of, however these is a plugin that removes the generator tag completely. You could easily modify this plugin to do the same for the description tag instead.

http://extensions.joomla.org/extensions/site-management/seo-a-metadata/12556

Upvotes: 0

Related Questions