Modify Joomla Page Title for SEO


For Joomla 1.0.x (click here for Joomla 1.5)
Joomla’s standard way of displaying page titles is with the Site Name first, a dash, and then the title of the content. This is not the best way to display the page title for search engine optimization (SEO). The page title is a very important element in determining the relevance and ranking of your page to a keyword search. The search engines consider the first part of the page title the most important, so altering the page title so that the content title comes first and the Site Name second is a definite improvement. This is easily changed in /includes/joomla.php. Find the following text around line 503:

 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'];  } }

and change to this:

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

Having the same Site Name on every page of your site, however only serves to reduce the relevance of each page title to the keyword search and your targeted content. To completely remove the Site Name, instead replace the function above with this:

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

Similar Posts:

  1. #1 by Web design - October 13th, 2008 at 18:35

    Thank you very Much…….

  2. #2 by Make Money blog - March 13th, 2009 at 14:55

    What vesion of Joomla is this??

  3. #3 by john - November 6th, 2009 at 06:25

    I tend to favour using plugins rather than hacking core code, there’s a few which will do this (SH404 is my favourite)

    Joomla 1.5 handles this stuff much better as well.

    Nice tutorial though

    John

(will not be published)
  1. No trackbacks yet.