如何修改Joomla 网站中的标签?
我的网站是在 joomla 1.5 中创建的。我想编辑我的网站页面标题标签。具体来说是 区域。我怎样才能做到这一点?
My website was created in joomla 1.5. I want to edit my website pages header tags. Specifically the <head>
area. How can I do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以在模板中自行添加
标签,并且可以在这些标签之间添加您想要的任何内容。在大多数 CMS 中,您可以完全控制 head 标签之间显示的内容。但是,使用 Joomla 时,您需要添加
。该标签的内容由 Joomla 自动填充,例如元数据(标题、描述等)。您可以在控制面板“站点”>“全局元数据”中编辑全局元数据。全局配置。此外,在您创建的每篇文章上,您都可以单击侧面菜单来编辑该特定文章的元数据。
然而,有些事情你无法轻易改变。例如,在 joomla 标签
中,它还会加载 MooTools 等。这意味着如果您希望在页面底部加载 Mootools,那么您就不走运了。您可以手动编辑 /libraries/joomla/document/html/html.php 中的标签,但是每次更新系统时,您所做的任何更改都可能会被覆盖。所以你不想这样做。You add the
<head>
tags yourself in your template and can add any content you wish between those tags. In most CMS's you have complete control in what appears between the head tags. With Joomla you are required to add<jdoc:include type="head" />
however. The content of that tag is automatically filled by Joomla such as meta data (title, description, etc.).You can edit the global meta data in the control panel Site > Global Configuration. Also on each article you create you can click on the side menu to edit the meta data for that particular article.
However, there are some things you cannot easily change. Such as in that joomla tag
<jdoc:include type="head" />
it also loads MooTools for instance. Which means if you wish to load Mootools at the foot of the page your out of luck. You could manually edit the tag in /libraries/joomla/document/html/html.php however whatever changes you make there may be overwritten every time you update the system. So you do not want to do that.要修改标题部分,您需要访问管理仪表板。在扩展/主题中,然后在主题中选择您的默认主题。进入编辑器,选择文件 /html/com_content/default.php,您可以根据需要修改该文件。
在同一位置,您可以找到包含标头部分的文件index.php。
To modify the head section you need to access to the admin dashboard. Inside Extensions/Themes, then into themes select your default theme. Go into the editor select the file /html/com_content/default.php and you could modified the file as you want.
At the same place you could find the file index.php that has the header section.
使用Joomla 4,但我认为在Joomla 3中是一样的,您可以读取标题,添加到它们,然后将它们写回。您可以在模板的index.php 靠近顶部的位置执行此操作。例如,代码看起来像:
这会将社交元数据添加到标签,例如......
Using Joomla 4, but I think it's the same in Joomla 3, you can read the headers, add to them, then write them back. You could do this in your template's index.php quite close to the top. The code would, for example, look like:
This would add social metadata to tags, like...
Joomla(甚至版本 3.6.x)不提供任何通过管理 UI 执行此操作的机制。有一些不同的较低级别选项(请参阅 https://docs.joomla.org/J3 .x:Adding_JavaScript_and_CSS_to_the_page),但非开发人员可能会发现很难使用。
有一些 Joomla 模板允许您指定要放置在标头末尾和/或正文部分末尾的全局自定义代码(例如 Google Analytics)。我正在使用这个: https://www.joomshaper.com/joomla-templates/helix3
Joomla (even version 3.6.x) doesn't provide any mechanism to do this via the admin UI. There are a few different lower-level options (see https://docs.joomla.org/J3.x:Adding_JavaScript_and_CSS_to_the_page) but non-developers may find it hard to use.
There are some Joomla templates that allow you to specify global custom code to be placed at the end of header and/or end of body sections (for example for Google Analytics). I'm using this one: https://www.joomshaper.com/joomla-templates/helix3