http://forum.joomla.org/index.php/topic,11357.0.html
http://forum.joomla.org/index.php/topic,18041.0.html
This hack will accomplish allowing you to set custom Title Tags for every menu item and content item in the parameter fields. This will help with SEO of your Joomla site unitl these issues are hopefully implemented in Joomla 1.1.
Here are the steps:
Please backup your files first
1. Insert Custom Title Tag Parameters
add the following line of code as a childNode of the node
Code: Select all
<param name="title_cust" type="text" size="20" default="" label="Custom Title Tag" description="A custom Title tag to be applied to the page, this allows individual page titling" />
administrator/components/com_menus/component_item_link/component_item_link.xml
and every subfolder under the com_menus/ directory that contains a .xml file. (ex. content_section/content_section.xml)
administrator/components/com_banners/banners.xml
and every subfolder under the administrator/components/ directory that contains a .xml installer file. (ex. com_frontpage/frontpage.xml)
Note: when you install a new component you will have to add the line of code to the component's .xml installer file
2. Edit content.php File
open file: components/com_content/content.php
look under the function showItem and replace the following code around line 1341:
Code: Select all
// page title
$mainframe->setPageTitle( $row->title );
Code: Select all
// page title
$mainframe->setPageTitle( $row->title, $params );
3. Edit joomla.php File
open file: includes/joomla.php (for Mambo: includes/mambo.php)
look for function setPageTitle under the class mosMainFrame around line 468 and replace: (Mambo line: 128)
Code: Select all
function setPageTitle( $title=null ) {
if (@$GLOBALS['mosConfig_pagetitles']) {
$title = trim( htmlspecialchars( $title ) );
$this->_head['title'] = $title ? $GLOBALS['mosConfig_sitename'] . ' - '. $title : $GLOBALS['mosConfig_sitename'];
}
}
Code: Select all
function setPageTitle( $title=null, $params=null ) {
if (@$GLOBALS['mosConfig_pagetitles']) {
if ($params) {
$custom_title = $params->def( 'title_cust', '' );
} else {
global $database, $mainframe, $Itemid;
$params = new stdClass();
if ( $Itemid ) {
$menu = new mosMenu( $database );
$menu->load( $Itemid );
$params = new mosParameters( $menu->params );
} else {
$menu = "";
$params = new mosParameters( '' );
}
$custom_title = $params->def( 'title_cust', '' );
}
$title = $custom_title ? $custom_title : $GLOBALS['mosConfig_sitename'] . ' - '. $title;
$title = trim( htmlspecialchars( $title ) );
$this->_head['title'] = $title ? $title : $GLOBALS['mosConfig_sitename'];
}
}
4. Edit the root index.php File *new addition
open file: index.php (not your template one, but the actual one in your root folder of your Joomla install)
after line 100 where you see this:
Code: Select all
// mainframe is an API workhorse, lots of 'core' interaction routines
$mainframe = new mosMainFrame( $database, $option, '.' );
$mainframe->initSession();
Code: Select all
$mainframe->setPageTitle();
That should complete the hack!
Now log into the administrator end and change the "Custom Title Tag" parameters on your menu items and content items. If you leave the parameter blank then Joomla will use the default Site Name and page Name as the Title.
Let me know if this works or doesn't. Have fun.
-Barnett