: How to remove page/menu from page title in Joomla 2.5 and 3+ on front page only I have a Joomla 2.5 website and I would like to remove the page/menu name from appearing in the title so
I have a Joomla 2.5 website and I would like to remove the page/menu name from appearing in the title so it does not display in Google or the browser tab. Currently the homepage is appending 'HOME' to the page title i.e:
<title>Example Sitename - Page/Menu Name</title>
I know that the "Browser Page Title" can be found within "Page Display Options", but if I leave it empty, it uses the Menu Item Title.
Please note that I only want to remove the page/menu name on the front page of site, also the solution should be working for bilingual (or multilingual) websites, that means "My Website - Home" will be "My Website" and other languages will follow the same rule, i.e. "Mon Website - Accueil" will be "Mon Website".
More posts by @Frith620
7 Comments
Sorted by latest first Latest Oldest Best
As George Okello said, you have to notice the First page's Id. Go to Menu Manager and find them out for each language. There must be a different configuration if you have a plugin for multilingual websites.
in my case both ids were 127 and 128. So the solution is to put the following code before the <jdoc:include type="head" />.
<?php
$menuItemId = JRequest::getInt('Itemid');
if ($menuItemId == 127) : $this->setTitle('Theater of the Deaf of Greece');
elseif ($menuItemId == 128) : $this->setTitle('Θέατρο Κωφών Ελλάδος');
endif;
?>
Now if you have a multilingual website, all you have to do is to copy the line elseif ($menuItemId == xx ) : $this->setTitle('xxxx'); and paste it before the endif; for as many languages (or pages with unique id's) you wish.
To do this in Joomla 2.5 do the following steps:
Login to the Joomla backend using your administrator account
Click menu manager
Click Main Menu
Click on Home and take note of the menu ID.
Then add the following code to template's index.php file, before <jdoc:include type="head" /> (note that in the example below, 101 should be replaced with the actual ID number on your site as mentioned in the steps above.
<?php
$menuItemId = JRequest::getInt('Itemid');
if ($menuItemId == 101) $this->setTitle('');
?>
If you want a custom title, e.g. My Custom Title, then use:
$this->setTitle('My Custom Title');
I have not tested this on a multilingual website, but assuming each language has its own home page, you would just test for all home pages, using their unique menu item ids.
The Joomla plugin called Title Manager can handle this for you. Simply use:
Only show site name on home page: Yes
I strongly recommend installing AceSEF or SH404SEF within Joomla. AceSEF is free and does the job while SH404SEF tends to have slightly more features but comes a price. Joomla SEO is ok out of the box but its far from perfect, altering templates is ok but using an extension is far easier and does more SEO than just what you asked.
These plugins can be installed on all versions of Joomla:
Joomla 1.5
Joomla 2.5
Joomla 3.0
Joomla 3.5 and above...
The only solution I found until now (Joomla 3.0) is adding the following snippet in your template's index.php file before <jdoc:include type="head" />.
The snippet for my page looks like this:
<?php
if (!strncmp($this->getTitle(), "Home", 4))
{
$app = JFactory::getApplication();
$this->setTitle( $app->getCfg( 'sitename' ) );
}
?>
This basically is a hack that replaces the title if it begins with "Home".
<?php
$title = $this->getTitle();
$app = JFactory::getApplication();
//$this->setTitle( $title . ' - ' . $app->getCfg( 'sitename' ) );
$this->setTitle( 'your funky title' );
?>
It is all in here
Try adding if(str_pos($this->getTitle(), "Part of your home page title")!=false)
Make sure "Show Page Heading" is set to No under Page Display Options for the Home menu item. That will hide the title as long as you have also set "Show Title" to Hide under Article options of the same menu item.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.