 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
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.
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
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.
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.
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_paget itles']) {
$title = trim( htmlspecialchar s( $title ) );
$title = stripslashes($t itle);
$this->_head['title'] = $title ? $GLOBALS['mosConfig_siten ame'] . ' - '. $title : $GLOBALS['mosConfig_siten ame'];
}
}
chage to :
function setPageTitle( $title=null ) {
if (@$GLOBALS['mosConfig_paget itles']) {
$title = trim( htmlspecialchar s( $title ) );
$this->_head['title'] = $title ? $title . ' - ' . $GLOBALS['mosConfig_siten ame'] : $GLOBALS['mosConfig_siten ame'];
}
}
Now you will mtree.php
# Set Page Title
if ( $cat_id == 0 ) {
$mainframe->setPageTitle( $_MT_LANG->ROOT );
$cat->cat_allow_submi ssion = $mtconf->get('allow_listings_ submission_in_r oot');
} else {
$mainframe->setPageTitle( html_entity_dec ode_utf8($cat->cat_name) );
}
change to :
# Set Page Title
if ( $cat_id == 0 ) {
$mainframe->setPageTitle( 'Descargas Gratis de Software' );
$cat->cat_allow_submi ssion = $mt_allow_listi ngs_ submission_in_r oot;
} 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_dec ode_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
Which version of Mostree are you working with?
$this->_head['meta'][$i][1] = $content .', '. $this->_head['meta'][$i][1];
to
$this->_head['meta'][$i][1] = $this->_head['meta'][$i][1] .', '. $content;
RSS feed for comments to this post