Custom Title Tag Hack for every page
- barnett
- Joomla! Intern
- Posts: 76
- Joined: Fri Aug 19, 2005 12:52 pm
- Location: Nyack, NY
Re: Custom Title Tag Hack for every page
@ limin - to my knowledge sections can only appear if you link to them from a menu, so you can set the custom title in the menu params.
@ mattr2110 - categories are a different question. If they are linked to directly in the menu then the same applies from above, otherwise I'm not sure how to do it since there are no params for categories.
-barnett
@ mattr2110 - categories are a different question. If they are linked to directly in the menu then the same applies from above, otherwise I'm not sure how to do it since there are no params for categories.
-barnett
http://www.contemplatedesign.com/ - Joomla Development & Design
- leslienord
- Joomla! Apprentice
- Posts: 24
- Joined: Fri Mar 17, 2006 7:47 pm
- Contact:
Re: Custom Title Tag Hack for every page
Can this be used after implementing the Joomla SEF Patch? I found that patch before I found this.
Leslie
http://www.websyourway.com
http://www.websyourway.com
- slimtreeshadow
- Joomla! Apprentice
- Posts: 23
- Joined: Thu May 11, 2006 7:32 pm
- Contact:
This works great
A great addition - thanks so much!
-adam
-adam
Adam Audette, Moderator & Publisher
LED Digest | Marketing Discussion List
http://www.led-digest.com/
since 1997
LED Digest | Marketing Discussion List
http://www.led-digest.com/
since 1997
-
- Joomla! Intern
- Posts: 87
- Joined: Tue Oct 04, 2005 2:12 am
Re: Custom Title Tag Hack for every page
First thank you for that solution.
It appears that linked menus to static content are unaffected by that hack. Can someone confirm please?
It appears that linked menus to static content are unaffected by that hack. Can someone confirm please?
Last edited by Lionel on Mon Jul 10, 2006 1:17 am, edited 1 time in total.
-
- Joomla! Apprentice
- Posts: 33
- Joined: Mon Aug 29, 2005 3:10 pm
Re: Custom Title Tag Hack for every page
With the default includes/joomla.php, how would I go about just reversing the SiteName-PageTitle order? (This is with dynamic page titles turned on and working at present (http://www.shadowmonkey.net).
The result I'm looking for is to have PageTitle-SiteName show up insteaded of SiteName-PageTitle.
Thanks for any help.
jkrobin
The result I'm looking for is to have PageTitle-SiteName show up insteaded of SiteName-PageTitle.
Thanks for any help.
jkrobin
- barnett
- Joomla! Intern
- Posts: 76
- Joined: Fri Aug 19, 2005 12:52 pm
- Location: Nyack, NY
Re: Custom Title Tag Hack for every page
For the default includes/joomla.php look in the setPageTitle() function and replace this line:jkrobin wrote: With the default includes/joomla.php, how would I go about just reversing the SiteName-PageTitle order?
Code: Select all
$this->_head['title'] = $title ? $GLOBALS['mosConfig_sitename'] . ' - '. $title : $GLOBALS['mosConfig_sitename'];
Code: Select all
$this->_head['title'] = $title ? $title . ' - '. $GLOBALS['mosConfig_sitename'] : $GLOBALS['mosConfig_sitename'];
if you are using the Custom Title Tag hack I created above and want to switch the order look in the same function and replace:
Code: Select all
$title = $custom_title ? $custom_title : $GLOBALS['mosConfig_sitename'] . ' - '. $title;
Code: Select all
$title = $custom_title ? $custom_title : $title . ' - '. $GLOBALS['mosConfig_sitename'];
Code: Select all
$title = $custom_title ? $custom_title . ' - '. $GLOBALS['mosConfig_sitename'] : $title . ' - '. $GLOBALS['mosConfig_sitename'];
-barnett
http://www.contemplatedesign.com/ - Joomla Development & Design
-
- Joomla! Apprentice
- Posts: 33
- Joined: Mon Aug 29, 2005 3:10 pm
Re: Custom Title Tag Hack for every page
Thanks very much, barnett! ...works great.
-jkrobin
-jkrobin
-
- Joomla! Fledgling
- Posts: 1
- Joined: Sat Jul 29, 2006 11:52 am
Re: Custom Title Tag Hack for every page
Hello Barnett,
Thanks for such wonderful procedure for custom title tag. After using this hack we are able to place custom tag on each page, but we are still not able to edit the Meta Tags on the index page. Can you help me in placing custom Meta Tags on the index page. One more issue which I need to discuss is, after using the hack I find Two Title Tags been generated on my page, as shown below
This is your custom title
Is there any option to omit from the page...
Thanks!
Thanks for such wonderful procedure for custom title tag. After using this hack we are able to place custom tag on each page, but we are still not able to edit the Meta Tags on the index page. Can you help me in placing custom Meta Tags on the index page. One more issue which I need to discuss is, after using the hack I find Two Title Tags been generated on my page, as shown below
This is your custom title
Is there any option to omit from the page...
Thanks!
-
- Joomla! Enthusiast
- Posts: 110
- Joined: Sun Nov 20, 2005 7:00 pm
Re: Custom Title Tag Hack for every page
It looks to me that any menu type "Link - *" inherits the custom title of what it is actually linking to. I tried linking the Home link in my main menu to my top menu and the custom title I set for my top menu link did not get displayed.Lionel wrote: First thank you for that solution.
It appears that linked menus to static content are unaffected by that hack. Can someone confirm please?
Because Joomla ROCKS!!! It f*@cking ROCKS I say!!!
-
- Joomla! Apprentice
- Posts: 8
- Joined: Wed Dec 21, 2005 11:14 am
Re: Custom Title Tag Hack for every page - problems with apostrophes
Hi, I have a problem - that I partially solved - with apostrophe in page titles.
If the custom title contains an apostrophe a slash is been added before it.
So, if title_cust parameter is
Bob's page
the page title will be rendered as
Bob\''s page
My solution consists in changing the joomla.php hack in the following way (modificaitions in bold red):
function setPageTitle( $title=null, $params=null ) {
if (@$GLOBALS['mosConfig_pagetitles']) {
if ($params) {
$custom_title = stripslashes($params->def( 'title_cust', '' ));
} else {
global $database, $mainframe, $Itemid;
$params = new stdClass();
if ( $Itemid ) {
$menu = new mosMenu( $database );
$menu->load( $Itemid );
$params = new mosParameters( $menu->params );
} else {
$menu = "";
$params = new mosParameters( '' );
}
$custom_title = stripslashes($params->def( 'title_cust', '' ));
}
$title = $custom_title ? $custom_title : $GLOBALS['mosConfig_sitename'] . ' - '. $title;
$title = stripslashes( $title );
$title = trim( htmlspecialchars( $title ) );
$this->_head['title'] = $title ? $title : $GLOBALS['mosConfig_sitename'];
}
}
Not very complex, as you can see...a simple stripslashes command.
This solves the problem on the frontend: the page title has no more slashes.
But doesn't solve the problem in the backend. Infact, clicking on a content Item to edit it, the 'Custom Title' parameter filed contains the slashes. Saving the content without correcting it means that next time i click on that content i will find one more slash...and so on.
I repeat: this doesn't affect my frontpage, the user won't see any slash. But I think that my solution in not very elegant...
Does anyone have a better idea?
Thank you,
Scarpantibus
If the custom title contains an apostrophe a slash is been added before it.
So, if title_cust parameter is
Bob's page
the page title will be rendered as
Bob\''s page
My solution consists in changing the joomla.php hack in the following way (modificaitions in bold red):
function setPageTitle( $title=null, $params=null ) {
if (@$GLOBALS['mosConfig_pagetitles']) {
if ($params) {
$custom_title = stripslashes($params->def( 'title_cust', '' ));
} else {
global $database, $mainframe, $Itemid;
$params = new stdClass();
if ( $Itemid ) {
$menu = new mosMenu( $database );
$menu->load( $Itemid );
$params = new mosParameters( $menu->params );
} else {
$menu = "";
$params = new mosParameters( '' );
}
$custom_title = stripslashes($params->def( 'title_cust', '' ));
}
$title = $custom_title ? $custom_title : $GLOBALS['mosConfig_sitename'] . ' - '. $title;
$title = stripslashes( $title );
$title = trim( htmlspecialchars( $title ) );
$this->_head['title'] = $title ? $title : $GLOBALS['mosConfig_sitename'];
}
}
Not very complex, as you can see...a simple stripslashes command.
This solves the problem on the frontend: the page title has no more slashes.
But doesn't solve the problem in the backend. Infact, clicking on a content Item to edit it, the 'Custom Title' parameter filed contains the slashes. Saving the content without correcting it means that next time i click on that content i will find one more slash...and so on.
I repeat: this doesn't affect my frontpage, the user won't see any slash. But I think that my solution in not very elegant...
Does anyone have a better idea?
Thank you,
Scarpantibus
-
- Joomla! Enthusiast
- Posts: 183
- Joined: Fri Mar 03, 2006 10:47 pm
- Location: Toronto
Re: Custom Title Tag Hack for every page
general comment: its a good hack but becomes pointless when Joomla issues so many release versions that forces you to re edit the files in question. When you maintain a large numbers of Joomla sites, it becomes a real pain in the but. I cant see why this can't be implemented into the core instead of it being a "hack"
I like the Joomla SEF patch and that should also get taken into consideration.
I like the Joomla SEF patch and that should also get taken into consideration.
-
- Joomla! Enthusiast
- Posts: 110
- Joined: Sun Nov 20, 2005 7:00 pm
Re: Custom Title Tag Hack for every page
I agree. It would be nice to see this included in the core files. This is a HUGE issue for any site wanting to tweak their meta-tags for SEO purposes.
Because Joomla ROCKS!!! It f*@cking ROCKS I say!!!
-
- Joomla! Intern
- Posts: 80
- Joined: Sat Nov 26, 2005 2:59 am
Re: Custom Title Tag Hack for every page
Just wanted to say thanks. This really helped me
-
- Joomla! Apprentice
- Posts: 5
- Joined: Thu Oct 06, 2005 6:07 pm
Re: Custom Title Tag Hack for every page
great hack by the way..
just noticed while implementing this for SEO purposes that in components/com_content/content.php (J! 1.0.10) there are calls to SetPageTitle instead of setPageTitle, and the only implementation of a page title function i can find is the setPageTitle in includes/joomla.php.
is this a type-o, or am i missing something?
just noticed while implementing this for SEO purposes that in components/com_content/content.php (J! 1.0.10) there are calls to SetPageTitle instead of setPageTitle, and the only implementation of a page title function i can find is the setPageTitle in includes/joomla.php.
is this a type-o, or am i missing something?
- josey
- Joomla! Enthusiast
- Posts: 100
- Joined: Thu Jan 12, 2006 9:10 pm
- Location: Lake Michigan
Re: Custom Title Tag Hack for every page
great hack. thanks.
it seemed to work on the site i used it on, but the second site i did it shows the title tag field on the content pages, but only shows up on the site's title area if the page is a static page?
joomla 1.0.11
any ideas
cheers
############
fixed it. i triple checked the .xml files, moved the parm to the top, and edited the title tag field in the content pull down list, instead of going to the mainmenu list of pages, where i also have a title tag fields.
cheers
it seemed to work on the site i used it on, but the second site i did it shows the title tag field on the content pages, but only shows up on the site's title area if the page is a static page?
joomla 1.0.11
any ideas
cheers
############
fixed it. i triple checked the .xml files, moved the parm to the top, and edited the title tag field in the content pull down list, instead of going to the mainmenu list of pages, where i also have a title tag fields.
cheers
Last edited by josey on Fri Sep 29, 2006 5:19 pm, edited 1 time in total.
- php4ever
- Joomla! Explorer
- Posts: 290
- Joined: Tue Aug 30, 2005 3:40 pm
- Location: United States of America
- Contact:
JOOMLA 1.0.11 Custom Title Tags
Here is a zip file I created with all the changes and backups in place.
Its intended for use by new installs of Joomla 1.0.11, however if you have third party components you will just need to go to those components and add the following line as originally instructed.
I will maintain successive packages to help out with barnett if thats ok, as each release of Joomla becomes available so in the event that Joomla releases 1.0.12 and so on I'll make it as an easy drop in.
Just follow the instructions in the README.TXT file included with the zip. http://www.jaredsdesigns.com/downloads/ ... 1.0.11.zip
~ Jared
POST KEYWORDS: "Joomla 1.0.11 Custom Title, Titles Tags, Dynamic Titles"
PS Good Job "barnett"
Its intended for use by new installs of Joomla 1.0.11, however if you have third party components you will just need to go to those components and add the following line as originally instructed.
I will maintain successive packages to help out with barnett if thats ok, as each release of Joomla becomes available so in the event that Joomla releases 1.0.12 and so on I'll make it as an easy drop in.
Just follow the instructions in the README.TXT file included with the zip. http://www.jaredsdesigns.com/downloads/ ... 1.0.11.zip
~ Jared
POST KEYWORDS: "Joomla 1.0.11 Custom Title, Titles Tags, Dynamic Titles"
PS Good Job "barnett"
Last edited by php4ever on Wed Nov 01, 2006 6:13 pm, edited 1 time in total.
-
- Joomla! Apprentice
- Posts: 28
- Joined: Sun May 28, 2006 7:46 am
OPENSEF now not working
This is a great hack, thanks. Been looking around for some time. But now my opensef refuses to work for any new URL's. If fine for anything which exists, I just cant get it to re-write new ones. Any idea?
-
- Joomla! Apprentice
- Posts: 28
- Joined: Sun May 28, 2006 7:46 am
Re: OPENSEF now not working
triggeru571 wrote: This is a great hack, thanks. Been looking around for some time. But now my opensef refuses to work for any new URL's. If fine for anything which exists, I just cant get it to re-write new ones. Any idea?
opps - sorry guys - False Alarm. My mistake! I must have turned off theEnable SEF URL's from the main config. Its now working perfectly.
:-[:-[:-[:-[:-[
- LeGaS
- Joomla! Enthusiast
- Posts: 111
- Joined: Thu Aug 18, 2005 9:07 am
- Location: Hungary
Re: Custom Title Tag Hack for every page
This is a really nice hack, but I've got a problem with it.
When I edit the components/com_content/content.php file and upload it, then all of my content items disappear. They are in the database and in the administration, but I can't see them on the frontpage / menu items.
Do you have any idea?
When I edit the components/com_content/content.php file and upload it, then all of my content items disappear. They are in the database and in the administration, but I can't see them on the frontpage / menu items.
Do you have any idea?
- php4ever
- Joomla! Explorer
- Posts: 290
- Joined: Tue Aug 30, 2005 3:40 pm
- Location: United States of America
- Contact:
Re: Custom Title Tag Hack for every page
this happens when you edit that file in more than one place.
Download the examples I have above in the zip file and try the content.php file in there and see if that helps.
Jared
Download the examples I have above in the zip file and try the content.php file in there and see if that helps.
Jared
- LeGaS
- Joomla! Enthusiast
- Posts: 111
- Joined: Thu Aug 18, 2005 9:07 am
- Location: Hungary
Re: Custom Title Tag Hack for every page
Great, thanks! It solved the problem.
Regards,
LeGaS
Regards,
LeGaS
- slimtreeshadow
- Joomla! Apprentice
- Posts: 23
- Joined: Thu May 11, 2006 7:32 pm
- Contact:
How about upgrades
Anyone try this w/ upgrade installations? I've upgraded to 1.011 from about 1.07 or so. Before I risk it I wanted to check if anyone else tried already.
Adam Audette, Moderator & Publisher
LED Digest | Marketing Discussion List
http://www.led-digest.com/
since 1997
LED Digest | Marketing Discussion List
http://www.led-digest.com/
since 1997
-
- Joomla! Enthusiast
- Posts: 105
- Joined: Sun Jul 16, 2006 7:29 pm
Re: Custom Title Tag Hack for every page
Works nicely, thanks.
- eyezberg
- Joomla! Hero
- Posts: 2859
- Joined: Thu Aug 25, 2005 5:48 pm
- Location: Geneva mostly
- Contact:
Re: Custom Title Tag Hack for every page
Using SEF Advance, Joomla 1.0.11, SEF Patch.
Applied all 4 steps, double checked all changes.
Only thing that works is for content items, the content title is now used.
Any custom title inserted on menu links is simply ignored?!
Help welcome.
Applied all 4 steps, double checked all changes.
Only thing that works is for content items, the content title is now used.
Any custom title inserted on menu links is simply ignored?!
Help welcome.
Sometimes one pays most for the things one gets for nothing.
The important thing is not to stop questioning. Curiosity has its own reason for existing. AE
http://joomla15.[URL banned].com for J! 1.5 screenshots
http://www.eyezberg.com
The important thing is not to stop questioning. Curiosity has its own reason for existing. AE
http://joomla15.[URL banned].com for J! 1.5 screenshots
http://www.eyezberg.com
- infinitimm
- Joomla! Intern
- Posts: 66
- Joined: Mon Jul 24, 2006 5:14 pm
- Location: Ireland
- Contact:
Re: Custom Title Tag Hack for every page
Thanks Barnett,
A well considered and elegant solution to this problem, you have done us all a great service. Works brilliantly for me and will really help my optimisation.
Very good instructions, I am just a lowly web designer and not a programmer, but could follow the instructions to the letter.
A well considered and elegant solution to this problem, you have done us all a great service. Works brilliantly for me and will really help my optimisation.
Very good instructions, I am just a lowly web designer and not a programmer, but could follow the instructions to the letter.
- eyezberg
- Joomla! Hero
- Posts: 2859
- Joined: Thu Aug 25, 2005 5:48 pm
- Location: Geneva mostly
- Contact:
Re: Custom Title Tag Hack for every page
Does this work for you guys WITH SEF Advance (or another 3rd party sef solution) enabled?
I checked all edits again, it should be ok but works only on content items!? Not links to categoruies, sections or any other components I edited the xml for..
I checked all edits again, it should be ok but works only on content items!? Not links to categoruies, sections or any other components I edited the xml for..
Sometimes one pays most for the things one gets for nothing.
The important thing is not to stop questioning. Curiosity has its own reason for existing. AE
http://joomla15.[URL banned].com for J! 1.5 screenshots
http://www.eyezberg.com
The important thing is not to stop questioning. Curiosity has its own reason for existing. AE
http://joomla15.[URL banned].com for J! 1.5 screenshots
http://www.eyezberg.com
- barnett
- Joomla! Intern
- Posts: 76
- Joined: Fri Aug 19, 2005 12:52 pm
- Location: Nyack, NY
Re: Custom Title Tag Hack for every page
I have not tested it with the SEF ADvance or SEF Patch.... but I do use OpenSEF and it doesn't seem to interfere.eyezberg wrote: Using SEF Advance, Joomla 1.0.11, SEF Patch.
Applied all 4 steps, double checked all changes.
Only thing that works is for content items, the content title is now used.
Any custom title inserted on menu links is simply ignored?!
Help welcome.
Has anyone else had this issue with SEF Patch?
-barnett
http://www.contemplatedesign.com/ - Joomla Development & Design
- slimtreeshadow
- Joomla! Apprentice
- Posts: 23
- Joined: Thu May 11, 2006 7:32 pm
- Contact:
Re: Custom Title Tag Hack for every page
With JRE's SEF patch extended this doesn't work - at least it doesn't work for 1.010. I haven't tried w/ 1.011 yet.
It seems to interefere somehow w/ the custom title tags on menu items. It's just as eyezberg says.
It seems to interefere somehow w/ the custom title tags on menu items. It's just as eyezberg says.
Adam Audette, Moderator & Publisher
LED Digest | Marketing Discussion List
http://www.led-digest.com/
since 1997
LED Digest | Marketing Discussion List
http://www.led-digest.com/
since 1997
- eyezberg
- Joomla! Hero
- Posts: 2859
- Joined: Thu Aug 25, 2005 5:48 pm
- Location: Geneva mostly
- Contact:
Re: Custom Title Tag Hack for every page
sllim' thanks for confirming, (even tho' i use the free patch), I thought I was becoming stupid..
Sometimes one pays most for the things one gets for nothing.
The important thing is not to stop questioning. Curiosity has its own reason for existing. AE
http://joomla15.[URL banned].com for J! 1.5 screenshots
http://www.eyezberg.com
The important thing is not to stop questioning. Curiosity has its own reason for existing. AE
http://joomla15.[URL banned].com for J! 1.5 screenshots
http://www.eyezberg.com
- slimtreeshadow
- Joomla! Apprentice
- Posts: 23
- Joined: Thu May 11, 2006 7:32 pm
- Contact:
Re: Custom Title Tag Hack for every page
You bet. Here's a related thread about custom title tags w/ the JoomlatWork patch - http://www.joomlatwork.com/forum/index.php?topic=41.0.
Adam Audette, Moderator & Publisher
LED Digest | Marketing Discussion List
http://www.led-digest.com/
since 1997
LED Digest | Marketing Discussion List
http://www.led-digest.com/
since 1997