Feb 02 2007
MosTree and Search Engine Optimization Part 2 Print
Friday, 02 February 2007

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.


Comments (8)Add Comment
how about bluetree template?
written by skyjuice, February 07, 2007
did u have hack for bluetree temlate?
Alledia
written by steve, 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.
Changing the title tag per category or per listing...
written by 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
...
written by steve, 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.
web developer
written by 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.
I have a better Hack
written by 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 #__mt_cats WHERE cat_id='".$cat->cat_parent."' AND cat_published='1' LIMIT 1" );
$database->loadObject( $cat2 );

$database->setQuery( "SELECT cat_id, cat_name, cat_parent, cat_published FROM #__mt_cats WHERE cat_id='".$cat2->cat_parent."' AND cat_published='1' LIMIT 1" );
$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
...
written by Steve Burge, December 22, 2007
Wonderful - thank you for a great hack nenesio! smilies/smiley.gif

Which version of Mostree are you working with?
...
written by nenesio, December 22, 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;

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
smile
wink
laugh
grin
angry
sad
shocked
cool
tongue
kiss
cry
smaller | bigger

busy
 
Joomla SEO Club and Book Logo
Search
Login
Blog Details

Subscribe by RSS

Creative Commons License All blog articles are licensed under a Creative Commons Attribution 3.0 United States License.
Top Comment Posters
Good Web Practices
(114 comments)
Klaus Nitsche
(78 comments)
Brian Teeman
(67 comments)
Hummerbie
(35 comments)
guido
(34 comments)
Ansiklopedi
(30 comments)
Amy Stephen
(29 comments)
Yannick Gaultier
(28 comments)
Cory
(27 comments)
Anthony Olsen
(18 comments)
Blog Categories
Accessibility
Affiliates
Alledia News
Analytics
Book Reviews
Business
Design
Domain Names
Domain Tips & Tricks
Drupal
E-Commerce
Extensions of the Month
General CMS Issues
Interviews
Joomla Affiliates
Joomla 1.5
Joomla Blogs
Joomla Hacks
Joomla Hosting
Joomla News
Joomla People
Joomla SEO eBook
Joomla SEO Rankings
Joomla Sites
Joomla South East
Joomla Templates
Joomla Tips & Tricks
Joomla URLs
Open Questions
PHP
Pay Per Click
Product Reviews
Rants
Scams
Recommended Sites
Search Engine Optimization
Security
SEO
SEO Club
SEO Competition
Site Reviews
Template Clubs
Yellow Pages
Virtuemart
Vlogs
Wordpress
Translate
right