简体   繁体   English

页面标题显示为没有与joomla 3.2关联的菜单项的文章上的网站标题

[英]Page title showing up as site title on articles that do not have a menu item associated joomla 3.2

On all my Joomla pages I have the articles title as the h1 tag, so until now, Joomla has always displayed the title, ie what you see on the browser tab as the h1 tag. 在我所有的Joomla页面上,我都将文章标题作为h1标签,因此直到现在,Joomla始终显示标题,即您在浏览器选项卡上看到的h1标签。 (There were one and the same thing). (有一件是同一件事)。

However, this is not the case with all the pages that have no menu item linking to them, (they are linked to the rest of the site through another article). 但是,对于没有菜单项链接到它们的所有页面,情况并非如此(它们通过另一篇文章链接到网站的其余部分)。 Here the name of my site is the page title. 我的网站名称是页面标题。

How do I make the h1 tag the page title on these pages? 如何使h1标签成为这些页面上的页面标题?

Try this, 尝试这个,

This is happen due to those article pages meta options have title, Meta tag and keywords those are blank or not set yet. 发生这种情况的原因是,那些文章页面的元选项具有title, Meta tag and keywords这些title, Meta tag and keywords为空白或尚未设置。 Then this case Joomla will read those info from your Global settings It may have your site name and Global description. 然后,这种情况下,Joomla将从您的全局设置中读取这些信息。它可能包含您的网站名称和全局描述。

So the solution is set the Proper meta info for those articles from article manager. 因此,解决方案是从文章管理器设置这些文章的正确元信息。

If it is not practical then you can try it from article view or layout page Set meta data of Joomla page 如果不切实际,则可以从文章视图或布局页面尝试设置Joomla页面的元数据

在此处输入图片说明

Second Method is for setting the page title forcefully from scripts. 第二种方法是通过脚本强制设置页面标题。 It used for any components like here you have to check first method it will work for you.. 它用于任何组件,例如这里,您必须检查第一种方法是否适合您。

Hope its Helps.. 希望它的帮助。

Problem solved! 问题解决了! Here is how: 方法如下:

Make an override of com_content article and edit the default.php. 覆盖com_content文章,然后编辑default.php。 Around lines 42/43 you should have the following code (the line number may not be exact as I have already taken out some code for a previous override): 在第42/43行周围,您应该具有以下代码(行号可能不准确,因为我已经为先前的覆盖删除了一些代码):

<?php if ($params->get('show_title') || $params->get('show_author')) : ?>

Straight after that, add the following lines of code: 之后,添加以下代码行:

<?php $document=& JFactory::getDocument();
$document->setTitle( $this->item->title ); ?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM