Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

SEO Page Title - Free Modification Rate Topic   * * * * - 3 votes

 
  • StellarBytes
  • Senior Member
  • Members
  • Join Date: 08-Aug 11
  • 1807 posts

Posted 09 April 2013 - 11:31 AM #1

As you know, CS-Cart generates Page Titles like so for Categories and Products:-

Electronics :: Computers :: Laptops :: Gaming Laptops
Electronics :: Computers :: Laptops :: Gaming Laptops :: Alienware M18X Laptop

Wouldn't it be better to have your page title like this, conforming to best practises:

Gaming Laptops - Laptops - Computers - Electronics
Alienware M18X Laptop - Gaming Laptops - Laptops - Computers - Electronics

Well now you can change it to a more SEO-friendly structure. The "most important" keywords should be placed at the beginning of your Page Title, not at the end as default. So here's a quick, simple way to fix that.

Note, this only has an effect on products and categories where you have not added your own page title. This functionality replaces the default generation of the page title when it is otherwise blank.

Please make a back-up of any files you change before making any edits live on your site.

Open, depending on your CS-Cart version (Professional or Ultimate, # denotes Store ID):

/skins/your-skin/customer/index.tpl
OR
/stores/#/skins/your-skin/customer/index.tpl

Locate this code:
{strip}
<title>
{if $page_title}
	{$page_title|escape:"html"}
{else}
	{foreach from=$breadcrumbs item=i name="bkt"}
		{if !$smarty.foreach.bkt.first}{$i.title|unescape|strip_tags|escape:"html"}{if !$smarty.foreach.bkt.last} :: {/if}{/if}
	{/foreach}
	{if !$skip_page_title}{if $breadcrumbs|count > 1} - {/if}{$location_data.title|escape:"html"}{/if}
{/if}
</title>
{/strip}
And replace it with this code:
{strip}
<title>
{if $page_title && $controller != 'products' && $controller != 'categories'}
	{$page_title|escape:"html"}
{else}
	{foreach from=$breadcrumbs|array_reverse item=i name="bkt"}
		{if !$smarty.foreach.bkt.last}{if !$smarty.foreach.bkt.first} - {/if}{$i.title|unescape|strip_tags|escape:"html"}{/if}
	{/foreach}
	{if !$skip_page_title}{if $breadcrumbs|count > 1} - {/if}{$location_data.title|escape:"html"}{/if}
{/if}
</title>
{/strip}

This modification is tried and tested in V2.2.X and V3.0.X. It may also work for previous versions, but I am unable to test on 2.1.X or below.
Hire StellarBytes for CS-Cart Design & Development Services

 
  • curribhoys
  • Advanced Member
  • Members
  • Join Date: 29-Oct 12
  • 69 posts

Posted 10 April 2013 - 11:06 AM #2

Thank you StellarBytes.
Thanks,
Anand

 
  • johnny_n
  • Junior Member
  • Members
  • Join Date: 26-Apr 11
  • 23 posts

Posted 19 April 2013 - 02:27 PM #3

Bummer there's no hook there so the original file doesn't have to be modified.

 
  • clips
  • Aged Resident Loon
  • Members
  • Join Date: 14-Jan 07
  • 1650 posts

Posted 19 April 2013 - 10:03 PM #4

Very interesting and cool. Honestly never realized I have probably been doing this wrong for some time now. Now I see that I should not be putting anything in the "page title" field, but I cannot seem to get it to switch around like you are saying. Is there something other than the code you have here that I need to have set different on the site?
Regards,
Jim

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11384 posts

Posted 20 April 2013 - 06:02 AM #5

the "|array_reverse" should be reversing the breadcrumbs....

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • dvsgr
  • Senior Member
  • Authorized Reseller
  • Join Date: 14-Apr 09
  • 1448 posts

Posted 20 April 2013 - 07:38 AM #6

Hi

This is a nice solution.

Only downsize is that if you want to customize you categories title description it's not possible.

Is there a way around like an if the title fils is empty then.....use this if not then use custom field plus site name.

Fotis
Fotis Kourmadas
Cs-Cart Development - Cs-Cart Authorized Reseller 

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11384 posts

Posted 20 April 2013 - 07:50 PM #7

Someone would have to extend the data for the product and category. Products have the cscart_product_data field to store additional "stuff" related to a product however I'm not aware of a similar one for categories. In any event, someone would have to use the available hooks and develop the pre/post controllers to support the new data.

But why not just put what you want in the page title field if you're going to add a new field for customized info?

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • dvsgr
  • Senior Member
  • Authorized Reseller
  • Join Date: 14-Apr 09
  • 1448 posts

Posted 20 April 2013 - 08:30 PM #8

Thats standard use already in CS-Cart, I was jsut saying that if I want stronger SEO then I need my own meta title and the store name at the end. inorder to avoid rewritng it over and over again.
Fotis Kourmadas
Cs-Cart Development - Cs-Cart Authorized Reseller 

 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11384 posts

Posted 20 April 2013 - 08:43 PM #9

I thought someone had posted some free modification that would allow you to specify your page title using variable names.... I don't use it so you'll have to look.

EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • clips
  • Aged Resident Loon
  • Members
  • Join Date: 14-Jan 07
  • 1650 posts

Posted 20 April 2013 - 11:16 PM #10

I guess you could also use the free mod at...
http://1clue.com/dyn...age-titles.html
...that does a similar type thing. This may be the one that tbirnseth is speaking of too.
Regards,
Jim

 
  • dvsgr
  • Senior Member
  • Authorized Reseller
  • Join Date: 14-Apr 09
  • 1448 posts

Posted 20 April 2013 - 11:18 PM #11

Hi clips

I am aware of that, but it doesn't support categories. Just products and pages.
Fotis Kourmadas
Cs-Cart Development - Cs-Cart Authorized Reseller 

 
  • clips
  • Aged Resident Loon
  • Members
  • Join Date: 14-Jan 07
  • 1650 posts

Posted 20 April 2013 - 11:36 PM #12

The nice thing about the add-on from 1clue is you don't have to change any core files plus you can change them to any direction you want and add more stuff, like the price. We'll see if it helps.
Regards,
Jim

 
  • dvsgr
  • Senior Member
  • Authorized Reseller
  • Join Date: 14-Apr 09
  • 1448 posts

Posted 17 June 2014 - 08:41 AM #13

Hi guys

returning on this about v4

Now there is a hook in title {hook name="index:title"} so you can just open in my_changes folder (located in /design/themes/YOUR_THEME/templates/addons/) a folder with the name index and inside put the file title.override.tpl with this content

{if $page_title && $controller != 'products' && $controller != 'categories'}
		{$page_title|escape:"html"}
{else}
	{foreach from=$breadcrumbs|array_reverse item=i name="bkt"}
		
{if !$smarty.foreach.bkt.last} {if !$smarty.foreach.bkt.first} - {/if}{$i.title|strip_tags}{/if}

	{/foreach}
	{if !$skip_page_title && $location_data.title}{if $breadcrumbs|count > 1} - {/if}{$location_data.title}{/if}
{/if}

Now your Categories Pages look like this

Natural Gut - Babolat - Grids

instead of this

Grids :: Babolat :: Natural Gut

Tested in 403 and 415 (http://leweb.gr/cs41...category_id=168)

Thats all

Fotis
Fotis Kourmadas
Cs-Cart Development - Cs-Cart Authorized Reseller 

 
  • dvsgr
  • Senior Member
  • Authorized Reseller
  • Join Date: 14-Apr 09
  • 1448 posts

Posted 17 June 2014 - 09:18 AM #14

One more addition to this

If you add the

| {$settings.Company.company_name}

right after

		{foreach from=$breadcrumbs|array_reverse item=i name="bkt"}
				
{if !$smarty.foreach.bkt.last} {if !$smarty.foreach.bkt.first} - {/if}{$i.title|strip_tags}{/if}

		{/foreach}

and after

{if $page_title && $controller != 'products' && $controller != 'categories'}
                {$page_title|escape:"html"}

then you get the company name added right after the Title, of you page like this


Desktops - Computers - Electronics | Simtech

Fotis
Fotis Kourmadas
Cs-Cart Development - Cs-Cart Authorized Reseller 

 
  • crazyshark20
  • Junior Member
  • Members
  • Join Date: 19-Aug 09
  • 304 posts

Posted 23 January 2017 - 09:49 AM #15

design/themes/responsive/templates/addons/seo/hooks/index/meta.post.tpl
 
{if $languages|sizeof > 1}
    {$default_language = $languages[$settings.Appearance.frontend_default_language]}
    <link title="{$default_language.name}" dir="{$default_language.direction}" type="text/html" rel="alternate" hreflang="x-default" href="{$config.current_url|fn_url|fn_query_remove:"sl"}" />
    {foreach from=$languages item="language"}
    <link title="{$language.name}" dir="{$language.direction}" type="text/html" rel="alternate" hreflang="{$language.lang_code}" href="{$config.current_url|fn_link_attach:"sl=`$language.lang_code`"|fn_url}" />
    {/foreach}
{/if}
 
can we but each multi site name in store title 
like this
simtech site
Desktops - Computers - Electronics | Simtech
cs-cart site
Desktops - Computers - Electronics | cs-cart
 


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19764 posts

Posted 23 January 2017 - 02:40 PM #16

 

can we but each multi site name in store title 
like this
simtech site
Desktops - Computers - Electronics | Simtech
cs-cart site
Desktops - Computers - Electronics | cs-cart
 

 

 

Try to add the following code at the end

{$company.company_id|fn_get_company_name}

Note that you provided code for languages not for store-fronts


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • crazyshark20
  • Junior Member
  • Members
  • Join Date: 19-Aug 09
  • 304 posts

Posted 23 January 2017 - 04:54 PM #17

Tanks for help i test in meta.post.tpl. i put in at the top in it

 

{$settings.Company.company_name}

 

it show in main store name but your share code is nothing to do.

 

and can you share the all code we see correctly way :)



 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19764 posts

Posted 24 January 2017 - 08:15 AM #18

Tanks for help i test in meta.post.tpl. i put in at the top in it
 
{$settings.Company.company_name}
 
it show in main store name but your share code is nothing to do.
 
and can you share the all code we see correctly way :)

 

In CS-Cart (not Multi-Vendor) please try

{$runtime.company_id|fn_get_company_name}

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • crazyshark20
  • Junior Member
  • Members
  • Join Date: 19-Aug 09
  • 304 posts

Posted 24 January 2017 - 07:35 PM #19

Dear ecomlabs
Thanks for sharing its work. but can you help, its the right place because I can not see how gogle sees my title. i look arround but cant find live test.
 
{if $languages|sizeof > 1}
    {$default_language = $languages[$settings.Appearance.frontend_default_language]}
    <link title="{$default_language.name}" dir="{$default_language.direction}" type="text/html" rel="alternate" hreflang="x-default" href="{$config.current_url|fn_url|fn_query_remove:"sl"}" /> {$runtime.company_id|fn_get_company_name}
    {foreach from=$languages item="language"}
    <link title="{$language.name}" dir="{$language.direction}" type="text/html" rel="alternate" hreflang="{$language.lang_code}" href="{$config.current_url|fn_link_attach:"sl=`$language.lang_code`"|fn_url}" /> {$runtime.company_id|fn_get_company_name}
    {/foreach}
{/if}
 
Thanks for all..


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19764 posts

Posted 25 January 2017 - 07:31 AM #20

Page title can be adjusted in the following file

 

design/themes/THEME/templates/index.tpl

{capture name="page_title"}
{hook name="index:title"}
{if $page_title}
    {$page_title}
{else}
    {foreach from=$breadcrumbs item=i name="bkt"}
        {if !$smarty.foreach.bkt.first}{$i.title|strip_tags}{if !$smarty.foreach.bkt.last} :: {/if}{/if}
    {/foreach}
    {if !$skip_page_title && $location_data.title}{if $breadcrumbs|count > 1} - {/if}{$location_data.title}{/if}
{/if}
{/hook}
{/capture}
<title>{$smarty.capture.page_title|strip|trim nofilter}</title>

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.