开发者

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 whol开发者_StackOverflowe 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!


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;
?>


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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜