在 Joomla 1.5 中删除元描述而不更改核心
有谁知道如何在不更改 Joomla 核心的情况下删除元标记描述。我发现添加 $this->setDescription(null);在我的模板中它可以工作,但这只是将标签留空。我想把它完全脱掉。
我花了整个下午的时间进行研究,但似乎更改核心是唯一的选择,但是我对这个选项不满意,因为未来的升级可能会覆盖我的更改。
提前致谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 templates/mytemplate/ component.php /index.php 中删除以下内容:
这将删除所有元素
,但它也会删除所有 js 和css 文件这不酷!所以我要做的是:
以数组形式访问所有头元素:
$document = $this->getHeadData();
访问路径引用:
$baseURL=JURI: :base(true);
抓取所有脚本(包括所有使用 addScript() 方法加载的脚本):
抓取所有样式表(包括所有使用 addStyleSheet() 方法加载的脚本):
抓取所有内部脚本元素(例如添加了addScriptDeclaration 或 JFactory::getEditor) 与 script 方法一起使用:
获取所有自定义脚本(例如编辑器初始化参数):
最后回显
中的语句:
in templates/mytemplate/ component.php /index.php remove the following :
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) :
to grab all stylesheets (inc all loaded with addStyleSheet()method):
to grab all internal script elements (e.g. added with addScriptDeclaration or JFactory::getEditor) use this with the script method:
to grab all custom scripts (e.g. editor initialization params) :
finally echo the statements in the
<head>
:另一种方法(不破解 component.php)是在模板文件夹中创建一个新的 tmpl 文件,即:
在该文件夹中将有 Index.php 和 component.php
你可以创建另一个,例如blank.php
指定所需的标头,
并使用
使用
?tmpl=blank
调用它Also the other way (without hacking the component.php) is to create a new tmpl file in the template folder i.e:
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
这可以通过插件来完成。据我所知,没有一个可以完全删除标签,但是这是一个可以完全删除生成器标签的插件。您可以轻松修改此插件,以对描述标签执行相同的操作。
http://extensions.joomla.org/extensions/site-management /seo-a-metadata/12556
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