 I had the pleasure of talking to Phil Braddock, a Melbourne based Joomla developer, over the Christmas holidays. He runs Salsa Internet and is someone who comes at Joomla from the perspective of someone focused on trying to improve Joomla's SEO performance. There seems to be an increasing number of us! As the number of people wanting to use Joomla increases, a lot of people are working out how to improve its less SEO-friendly aspects. One of those is inability to create a unique meta title that might be different from what actually appears on the page. To give an example from Phil's site, his portfolio page is simple has the words "Portfolio > Websites" on the top of the content item. That makes sense to a reader, but is next to useless if it was also the meta title. Look up to the browser bar however, and you'll see the page's actual meta title is: "Joomla Web Design and Client Website Portfolio of our work, Melbourne, Australia". Stuffed with valuable keywords! How did he do this? In Joomla content items you have the "Title" and the "Title Alias". Often people don't utilize the alias field, but with a little hacking you can add your super-duper meta title in the "Title Alias" field and still have your nice simple title on the page.
What do you need to do? Follow these five simple instructions: 1. OPEN components/com_content/content.php 2. LOOK FOR: // page title $mainframe->setPageTitle( $row->title ); 3. CHANGE TO: // 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 ** NOTE: THIS MUST BE DONE IN 2 PLACES IN THE CONTENT.PHP FILE 4. OPEN includes/joomla.php file and look for: 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']; } } 5. Add the following function AFTER this (note: do not replace the setPageTitle function): // 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 ============
Thanks to Phil, and you can read his original post here . |
Comments
If you change the core files, you have to remember what you did with every new release and do it again on every site.
In the OpenSef Component, you have a choice in the configuration SEF encoding section that tells you:
"If you prefer to have friendly URLs based on the shorter form of the pages' titles, select Title Alias here and ensure your content items have both titles"
So fill in you noraml keyword richt title and a short alias and your done.
Using this options gives you exactly what you want, and it is automatily done for every new release...
True, but are we on the same page here? These recommendations are to improve Joomla's metadata rather than URLs.
Look at the features they do a rewrite for, and yes, they do hack several files for you.
Main thing for me is that I want the best SEO for Joomla sites without hacking the files myself.
The combination of OpenSef and the SEF Patch has brought me very good page 1 positions in Google.
Joomlashack has just opened an SEO forum (www.joomlashack.com/component/option,com_smf/Itemid,183/board,59.0), I had a post in there about this.
I read a post a while back that relates to your forum discussion and did some digging around to find it:
http://www.seomoz.org/blogdetail.php?ID=1562
Basically these SEO guys are not sure which is best - Site Title or Page title first.
From the start I had wondered how I was going to produce search engine friendly browser titles without the global site name always being displayed. I asked the question in the Joomla! forums and received precisely 0 replies.
Just wanted to say thanks as the solution you present here was simple to implement and does exactly what I wanted
Glad you found it useful
Joomlatwork.com have a pretty good patch that also allows you to add a unique browser title.
Best of luck with your site migration!
Steve
It currently has 'The Environmental Illness Resource - Home'. I really need to be able to get rid of 'Home' and replace it with a few keywords that I used on my static site. Other than changing the 'Home' menu title does anybody have a hack to accomplish this?
Please mail me at maff (at) ei-resource (dot) org
Thanks!
At line 575 you replace the line:
$head[] = '' . $this->_head['title'] . '';
with:
if ($this->_head['title']=="The Environmental Illness Resource - Home")
{
$head[] = 'Your new SEO friendly title';
}
else
{
$head[] = '' . $this->_head['title'] . '';
}
Thats all!
Thanks!
RSS feed for comments to this post