Need a solution? Call Us Now!
1800 880 841

Changing the Joomla Title field to use Title_Alias

Joomla SEO Title 

There are quite a few free tools for Joomla that translate URL's into friendly URLS (JoomSEF, OpenSEF, 404SEF etc) but one significant part of creating a good site is having appropriate titles shown in the browser top bar.  This title is taken from the title tag in the HTML file.  It is important to configure this in your Joomla pages and content.

While there are commercial tools that can help you achieve this there is one small hack that can give you more control over this important SEO trick.


Guide.  Do the following

1. Look for and open components/com_content/content.php in a text editor.
2. Look for the following code within the file.

{moscode}// page title $mainframe->setPagetitle( $row->title );{/moscode}
3. Change the code to.

// If our title alias is less than 20 characters // the page title will be set to [site name] - [title] // else the page title will be set to [title_alias] if (strlen($row->title_alias) < 20 )      $mainframe->setPagetitle( $row->title ); }else      $mainframe->setPagetitleAlias( $row->title_alias ); }
## Note: This should be changed in two places within the content.php file

4. Now open includes/joomla.php file and look for.

}function setPagetitle( $title=null ) {     if (@$GLOBALS['mosConfig_pagetitles']) {         $title = trim( htmlspecialchars( $title ) );         $title = stripslashes($title);         $this->_head['title'] = $title? $GLOBALS['mosConfig_sitename'] . ' - '. $title : $GLOBALS['mosConfig_sitename'];     } }

5. Then add this function after the setPageTitle function (note: do not replace the current setPagetitle function!!!).

// setPagetitleAlias - function sets the title of the // page to tile_alias function setPagetitleAlias( $title_alias=null ) {     if (@$GLOBALS['mosConfig_pagetitles']) {          $title_alias = trim( htmlspecialchars( $title_alias ) );          $title_alias = stripslashes($title_alias);          $this->_head['title'] = $title_alias;     } }

Your DONE !!!

Now you should be using title_alias instead of title within content items.  So you need to go and fill in the title alias field for all content items as this is now the one displayed (unless it is less than 20 characters!!).

Joomla SEO has never been so easy!! Gain more relevance in the search engines with this little patch!!

Joomla Services

Joomla Brisbane
Joomla Web Design
Joomla Sydney
Joomla Melbourne
Joomla Designer
Joomla Design
Joomla SEO
Joomla Development
Joomla Perth
Joomla Developer
Joomla Company
Joomla Websites
Want to know more?Call 1300 880 841 or click here to contact us.

Featured Portfolio Websites

Sex Toys 24/7 website banner FRISKY ADULT SHOP