Placed in: Home viagra australia
viagra online
viagra sale
cialis online
cialis australia
Create a custom page title in Joomla 1.0.x

One of the most importart SEO factors there days is the ability to setup unique page titles whic reflect the content of each page. In Joomla 1.0.x this can be a little bit tricky, because it has a standard way of creating a page title.

There are a lot of tools (Artio, OpenSEF) that can create dynamic page titles, but they do more than you want. You just want control over the titles.

If you make these small amount of changes in the Joomla source code, the title will be created from the "Title Alias" that you fill in your back-end panel.

To get Joomla to use the title alias, use this code:

1. Open the following file:

components/com_content/content.php

 

2. Look for the following code:

// page title
 $mainframe->setPagetitle( $row->title );

 

3. Replace the code from 2. to this:

// If title alias < 20 characters, page title will be: Site name - title
 // else page title will be: title alias
 if (strlen($row->title_alias) < 20 )
 {
   $mainframe->setPagetitle( $row->title );
 }else{
   $mainframe->setPagetitlealias( $row->title_alias );
 }
 // END CODE SNIPPET 

 

4. Open the following file:

includes/joomla.php

 

5. Look for the following code:

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

 

6. Add the following code after the code shown in 5.:

// setPagetitlealias - title of the content page to use tile_alias instead
 /**
 * @param string
 */
 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;
   }
 }
  // END CODE SNIPPET 

 

And there you have it. If the "Title alias" from any content now has more characters than 20, that will be the new page title. Enjoy.


Tags:  SEO joomla custom page title how to

Interested in this topic? You might enjoy another article I've written called

Did you like this article? Subscribe to my feed or email to keep updated on new articles.

Spread the word and submit to:
Digg!Reddit!Del.icio.us!Facebook!StumbleUpon!
 
< Prev
Subscribe

Subscribe to Marcofolio