Welcome to Alledia, the #1 Joomla Training Company

Would you like to learn Joomla? We're here to help you: Sign Up Today

  • Professionally-produced training videos and tutorials.
  • Guaranteed same-day answers to all your Joomla questions.
  • No Joomla experience needed. We've taught 1000s of Joomla students.

Home / Search Engine Optimization / MosTree and Search Engine Optimization Part 2 
Feb
02
2007

MosTree and Search Engine Optimization Part 2

Written by Steve Burge   
Avatar

A while ago, we talked about how to make MosTree more Search Engine Friendly. Well, we have a Part 2 to that article, this time dealing with the way the word "Root" appears in the directory homepage and the titles for the inside page are simply the name of the category. Looking for something more descriptive and full of keywords?

We have a small hack that may help. This will give you the ability to changes the page titles to something more Search Engine Friendly.

A word of caution - you will need to open the mtree.php and make the edits yourself in three places.

?

On line 223 change:

$mainframe->setPageTitle( $_MT_LANG->ROOT );

to:

$mainframe->setPageTitle( 'Whatever I want my main page title for MosTree to be'? );

On line 226 change:

$mainframe->setPageTitle( $cat->cat_name );

to:

$mainframe->setPageTitle( $cat->cat_name. ' whatever I want to come after the category name on the category pages'? );

On line 1455 change:

$mainframe->setPageTitle( $link->link_name );

to:

$mainframe->setPageTitle( $link->link_name . ' - whatever I want to come after the listing name on the individual listing pages'? );

If you wanted to, you could also add in default text for the meta keywords and description, under each of these edits. You would need to make changes to these lines:
Lines 229 to 236 (root and category page)
Lines 1457 to 1466 (listings page)

A final word of warning

  • please backup the original mtree.php file
  • you will probably need to redo these changes when upgrading to future versions.

?

Free Weekly Joomla Tutorials

Your Comments (9)

0
skyjuice
February 07, 2007

did u have hack for bluetree temlate?

steve
Steve Burge
February 07, 2007

Hi SkyJuice.

This file should work for all MosTree templates. Part 1 of the tutorial should also need very little adapting for Bluetree. MosTree shares a lot of files between templates.

0
Onsite IT Resources
September 29, 2007

This is a great tip, I will most definitely add this to my 'to do' list!!

One question I have is... how can you change the title on a more granular level? For example, if I want the title tag to be different for different categories how would I go about doing that?

For example, if location based, and service oriented, I would not want "appliance repair" or "lawn care" to cross over into every category. How could you add the actual category 'theme' to that specific category and not others?

i.e. title tags for geographical based service index:

San Diego - Lawn Care and Grass Mowing Services
Dallas - Lawn Care and Grass Mowing Services

but then also have a separate category with titles...

San Diego - Small Engine Repair and Maintenance
Dallas - Small Engine Repair and Maintenance

These would be two separate categories etc...

So would you add the cat_name variable to the page title string so listings in that specific category would also have the category following the "location" which is also the url?

I think that would work, but wanted to see what you guys though...

By the way, your site is great!!

Matt

steve
Steve Burge
September 30, 2007

Hi Matt

Yes, if San Diego, Dallas etc. are part of the category name.

Otherwise, you may need to create a unique hack (similar to the Joomlatwork SEF Patch) which allows unique page titles for each listing and category.

0
ahmad
October 23, 2007

Hi
Could you please help me to solve this problem on mosets tree search engine . When i want to search "plumbing"
instead search "i am looking for plumber" when i do that does not works.
Thanks.

0
nenesio
December 22, 2007

There is a much better Hack, For example using mosets tree for car sales. As explained here would look something like this

Directory - Honda - Site Name

More SEO would look something like this

Buying your Honda Comfortable in shares - Site name

First you will includes / joomla.php

find this

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

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

Now you will mtree.php

# Set Page Title

if ( $cat_id == 0 ) {

$mainframe->setPageTitle( $_MT_LANG->ROOT );

$cat->cat_allow_submission = $mtconf->get('allow_listings_submission_in_root');

} else {

$mainframe->setPageTitle( html_entity_decode_utf8($cat->cat_name) );

}

change to :

# Set Page Title
if ( $cat_id == 0 ) {
$mainframe->setPageTitle( 'Descargas Gratis de Software' );
$cat->cat_allow_submission = $mt_allow_listings_submission_in_root;
} else {

//added for extra cats

$database->setQuery( "SELECT cat_id, cat_name, cat_parent, cat_published FROM jos_mt_cats WHERE cat_id='".$cat-$database->loadObject( $cat2 );

$database->setQuery( "SELECT cat_id, cat_name, cat_parent, cat_published FROM jos_mt_cats WHERE cat_id='".$cat2-$database->loadObject( $cat3 );
if($cat2!='' && $cat3!=''){
# Set Page Title
$pagepathway = ( 'Buying your ' . $cat3->cat_name . ' : ' . $cat2->cat_name . ' : ' . $cat->cat_name. ' Comfortable in shares' );
}elseif($cat2!='' && $cat3==''){
# Set Page Title
$pagepathway = ( 'DBuying your ' . $cat2->cat_name . ' : ' . $cat->cat_name. ' Comfortable in shares' );
}elseif($cat2=='' && $cat3 ==''){
# Set Page Title
$pagepathway = ( 'Buying your ' . $cat->cat_name. ' Comfortable in shares' );
}

$mainframe->setPageTitle( $pagepathway );

#$mainframe->setPageTitle( $cat->cat_name );

}

But also it is intended that the listing page has seo, find this :

# Set Page Title

$mainframe->setPageTitle( html_entity_decode_utf8($link->link_name) );

and change to :

# Set Page Title
$mainframe->setPageTitle( 'Buying your ' . $link->link_name. ' Comfortable in shares' );


This is the listing page daria something like this:

Buying your HONDA ACCORD 2008 Comfortable in shares - Site name

smilies/grin.gif smilies/grin.gif this is very very very seo

steve
Steve Burge
December 22, 2007

Wonderful - thank you for a great hack nenesio! smilies/smiley.gif

Which version of Mostree are you working with?

0
nenesio
December 23, 2007

this working en mosets tree 1.5.x and 2.x.x, And to the metas tags description and keywords functions change en joomla.php line 537 and 556 :


$this->_head['meta'][$i][1] = $content .', '. $this->_head['meta'][$i][1];

to

$this->_head['meta'][$i][1] = $this->_head['meta'][$i][1] .', '. $content;

0
UK Business Directory
December 27, 2009

Can a user enter links back to their site using keywords in a listing on mosets tree?

Write comment

 
  smaller | bigger
 

busy