Jan 04 2007
Using the Alias as the Page Title for Joomla SEO Print
Thursday, 04 January 2007

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 (10)Add Comment
Using the Joomla Alias for URL without hacking the core files
written by Hummerbie, January 04, 2007
If you use the OpenSef component to rewrite your URL, to make the nice URLs like the one's from salsa Internet, you don't have to hack the core files.

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... smilies/smiley.gif
True, but...
written by steve, January 04, 2007
Hi Hummerbie.

True, but are we on the same page here? These recommendations are to improve Joomla's metadata rather than URLs.
I see your point.. and give an other option
written by Hummerbie, January 04, 2007
True, If we are talking about Metadata and the titles that are generated by Joomla, the I suggest You try the SEF patch from www.joomlatwork.com there is a free version...

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.
??
written by Compass, January 07, 2007
I think any SEF component will allow you to use the alias instead of the title for your

Joomlashack has just opened an SEO forum, I had a post in there about this.
...
written by steve, January 07, 2007
True - OpenSEF definitely does. Thats fast becoming a GREAT component.

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.
Exactly what I needed!
written by Matthew Hogg, May 11, 2007
Thanks for writing about this SEO solution. I've been using Joomla! to build a replacement for my existing site as with 1000+ pages of content I needed a CMS to manage it.

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 smilies/grin.gif
...
written by steve, May 11, 2007
Hi Matthew

Glad you found it useful smilies/smiley.gif The browser title is just about the most important optimizing SEO feature site so its nice to have a way to add it.

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
Frontpage Browser Title
written by Matthew Hogg, September 18, 2007
I've realised there is one aspect that this patch does NOT fix. I still can't find a way to change the browser title for the frontpage.

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!
...
written by Ruud, October 25, 2007
At Matthew: Open includes/Joomla.php

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!
...
written by Ale, March 06, 2008
Is there anything similar to the solution above that take into consideration a multi-language website? I'm not a fan of hardcoding strings of any kind. Does anyone know how to use title alias for browser title in the frontpage, instead of menu item name?

Thanks!

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