Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Here is How to Change Page Title Tag Format (remove "::")

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 04-17-2010, 09:49 PM
  gallaghersean's Avatar 
gallaghersean gallaghersean is offline
 

Advanced Member
  
Join Date: Aug 2008
Location: Clearwater, FL
Posts: 52
 

Default Here is How to Change Page Title Tag Format (remove "::")

I figure I'd pass this along for anyone else wanting to know how to do this. If you want to change the format of the default :: character separator follow these instructions.

I don't know why X-Cart choose a double colon for a separator in their title tags it does not make much sense SEO-wise. The best format for the title tag is: Product Name - Category | Site Name. That is the best format for search engine according to current studies (reference: Best SEO Practices by SEOmoz).

So now on to the details... to change the format follow these steps:

For Page Titles like this: Product Name - Category - Site Name
  1. Open up the file include/templater/plugins/function.get_title.php
  2. Go to line 107.
  3. On this line you will find implode(' :: ', $tmp))); at the end of the line of code change the :: out for the - character or whatever you want. Now this will make your title tags look like this Product Name - Category - Site Name
For Page Titles like this: Product Name - Category | Site Name
  1. First make sure you have the setting in Main page :: General settings :: SEO options :: Page title format set to Product name :: Category name :: Shop name
  2. Open up the file include/templater/plugins/function.get_title.php
  3. Go to line 107.
  4. Replace that entire line
    $title = str_replace(array("\n", "\r"), array("", ""), trim(implode(' :: ', $tmp)));
    With the following:
    PHP Code:
    ############################################
    # Title Tag Hack By RocketMarketingInc.com #
    ############################################
    $title '';
    $titlePartCount count($tmp);
    $icount 1;
    foreach(
    $tmp as $titlePart)
    {
     if(
    $icount!=1) { $title .= ($icount!=$titlePartCount) ? ' - ' ' | '; }
     
    $title .= $titlePart;
     
    $icount++;
    }
    $title str_replace(array("\n""\r"), array(""""), trim($title)); 
That should do it! If you have any questions let me know.
And if you need any other help with SEO on your site feel free to contact me at RocketMarketingInc.com or the contact link in my sig.
__________________
.

Contact me about modifying x-cart for your needs.

Xcart Gold versions:
4.5.x, 4.4.3, 4.4.1, 4.4.0, 4.3.1
4.1.10, 4.1.9, 4.1.8

Add-on modules:

Featured Product Carousel
and other various mods I've built
Reply With Quote

The following 2 users thank gallaghersean for this useful post:
almenzies (07-04-2011), Mish (12-09-2012)
  #2  
Old 04-18-2010, 03:55 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: Here is How to Change Page Title Tag Format (remove "::")

Nice! Been meaning to tackle this one eventually as it has been driving me nuts as well. Thanks for sharing, moving this to the Custom Mods forum.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 04-18-2010, 08:01 AM
  hoosierglass's Avatar 
hoosierglass hoosierglass is offline
 

X-Adept
  
Join Date: Aug 2006
Location: Zionsville, IN
Posts: 974
 

Default Re: Here is How to Change Page Title Tag Format (remove "::")

I believe this is not needed when using CDSEO Pro.
__________________
X-Cart Gold 4.7.7
Custom Work from www.luminointernet.com
www.indy-pen-dance.com
Reply With Quote
  #4  
Old 04-18-2010, 08:36 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: Here is How to Change Page Title Tag Format (remove "::")

It is for some pages not covered by CDSEO Pro
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #5  
Old 04-18-2010, 10:40 AM
  gallaghersean's Avatar 
gallaghersean gallaghersean is offline
 

Advanced Member
  
Join Date: Aug 2008
Location: Clearwater, FL
Posts: 52
 

Default Re: Here is How to Change Page Title Tag Format (remove "::")

It's also good for those of us not using CDSEO Pro.
__________________
.

Contact me about modifying x-cart for your needs.

Xcart Gold versions:
4.5.x, 4.4.3, 4.4.1, 4.4.0, 4.3.1
4.1.10, 4.1.9, 4.1.8

Add-on modules:

Featured Product Carousel
and other various mods I've built
Reply With Quote
  #6  
Old 04-29-2010, 05:53 AM
 
Paulw Paulw is offline
 

Senior Member
  
Join Date: Jul 2004
Location: United Kingdon (Manchester)
Posts: 134
 

Default Re: Here is How to Change Page Title Tag Format (remove "::")

Any idea's how to do this on 4.1.9 as include/templater/plugins/function.get_title.php doesn't exist?

Great mod by the way!

Paul
__________________
X-Cart Gold V 4.4.1
Reply With Quote
  #7  
Old 04-29-2010, 06:10 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: Here is How to Change Page Title Tag Format (remove "::")

In 4.1.9 just edit customer/home.tpl. You'll see the title tag up top.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #8  
Old 04-29-2010, 06:11 AM
 
Paulw Paulw is offline
 

Senior Member
  
Join Date: Jul 2004
Location: United Kingdon (Manchester)
Posts: 134
 

Default Re: Here is How to Change Page Title Tag Format (remove "::")

I'm so thick! Many thanks

Paul
__________________
X-Cart Gold V 4.4.1
Reply With Quote
  #9  
Old 07-18-2010, 02:33 PM
 
jvannghi jvannghi is offline
 

Member
  
Join Date: Mar 2008
Posts: 23
 

Default Re: Here is How to Change Page Title Tag Format (remove "::")

Any idea on how to remove the "::" and replace with "-" on X-Cart version 4.1.5? Thanks.

-John
__________________
4.7.9
Reply With Quote
  #10  
Old 07-19-2010, 02:46 PM
  ADDISON's Avatar 
ADDISON ADDISON is offline
 

X-Man
  
Join Date: Jan 2008
Posts: 2,613
 

Default Re: Here is How to Change Page Title Tag Format (remove "::")

It could be inserted in General Settings. A text box for that divider.

I will suggested in 4.4
__________________
X-Cart Next: Business 5.2 (learning and testing)
X-Cart Classic: Gold and Gold Plus 4.7
Lots of Modules and Customizations
OS in use: Red Hat Enterprise, Fedora, CentOS, Debian, Ubuntu, Linux Mint, Kali Linux
Ideas for Server configuration (basicaly): Nginx/Pound (reverse proxy), Apache/Nginx (webserver), Squid/Varnish (cache server), HHVM or (PHP-FPM + PHP 5.6 + opcache), MariaDB/Percona MySQL Server, Redis (storing sessions)

You can catch my ideas here: http://ideas.x-cart.com
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 09:33 AM.

   

 
X-Cart forums © 2001-2020