Jump to content

SEO - Meta Titles and Descriptions


vittyc

Recommended Posts

Is there anyway I can control and update the meta titles and descriptions for pages. 

Currently the homepage says 'Portal Home' and if I go to WordPress hosting for example, I get 'Shopping Cart'

Can anyone recommended a plugin or a tutorial on how to get around this please? 

Cheers

Link to comment
Share on other sites

23 minutes ago, brian! said:

if you wanted to edit the header template, you could follow the post below as a starting point...

Thanks for the quick response Brian, makes sense - but how does that relate to "pages" where it's pulled from ID e.g. https://www.domain.com/cart.php?gid=1

Link to comment
Share on other sites

31 minutes ago, vittyc said:

Thanks for the quick response Brian, makes sense - but how does that relate to "pages" where it's pulled from ID e.g. https://www.domain.com/cart.php?gid=1

are you saying that you want each product group (and each cart step within that) to all have unique page titles and descriptions ?? possibly including the group name in the cart page titles ??

Link to comment
Share on other sites

On 06/01/2019 at 18:03, vittyc said:

Yeah if that's possible....?

oh it's possible in any number of ways, it just depends how thorough you need it to be, how complicated you want the code to look and what your desired output is.

On 06/01/2019 at 18:03, vittyc said:

I tried; 


{elseif $templatefile eq 'cart.php?gid=1'}

and no change, I don't think $templatefile is right, but not 100% sure what would work...

that wouldn't work (but you already know that now!) - templatefile is the correct variable to use, but it equals your template name (with at least one exception), not the query strings after the question mark.

let's say that you still want to go down the multilingual route using language strings to do this as outlined in the above thread, we can expand the code to the following...

	{if ($gid && !empty($LANG.pagetitle.{$templatefile}.{$gid}))}
		<title>{$LANG.pagetitle.{$templatefile}.{$gid}}</title>
	{elseif ($checkout)}
		<title>{$LANG.pagetitle.checkout}</title>
	{elseif ($productinfo && !empty($LANG.pagetitle.{$templatefile}.{$productinfo.pid}))}
		<title>{$LANG.pagetitle.{$templatefile}.{$productinfo.pid}}</title>	
	{elseif (!$inShoppingCart && !empty($LANG.pagetitle.{$templatefile}))}
		<title>{$LANG.pagetitle.{$templatefile}}</title>
	{else}
		<title>{if $kbarticle.title}{$kbarticle.title} - {/if}{$pagetitle} - {$companyname}</title>
	{/if}
	{if ($gid && !empty($LANG.metakeywords.{$templatefile}.{$gid}))}
		<meta name="keywords" content="{$LANG.metakeywords.{$templatefile}.{$gid}}">
	{elseif ($productinfo && !empty($LANG.metakeywords.{$templatefile}.{$productinfo.pid}))}
		<meta name="keywords" content="{$LANG.metakeywords.{$templatefile}.{$productinfo.pid}}">
	{elseif (!$gid && !empty($LANG.metakeywords.{$templatefile}))}
		<meta name="keywords" content="{$LANG.metakeywords.{$templatefile}}">
	{/if}
	{if ($gid && !empty($LANG.metadescription.{$templatefile}.{$gid}))}
		<meta name="description" content="{$LANG.metadescription.{$templatefile}.{$gid}}">
	{elseif ($productinfo && !empty($LANG.metadescription.{$templatefile}.{$productinfo.pid}))}
		<meta name="keywords" content="{$LANG.metadescription.{$templatefile}.{$productinfo.pid}}">		
	{elseif (!$gid && !empty($LANG.metadescription.{$templatefile}))}
		<meta name="description" content="{$LANG.metadescription.{$templatefile}}">
	{/if}

now i've kept the code as simple as practically possible to understand and expand (no I really have!), but let me explain those 5 title if statements...

  1. if $gid exists and a language override exists for that product group, then output that language string - this should only occur with the Products template page, e.g the group categories opening page.
  2. if you are at checkout, then use the "checkout"  language override - this rule is because for both viewcart and checkout, $templatefile = "viewcart", so this allows you to distinguish between viewcart and checkout.
  3. if $productinfo exists and a language override exists for that product (could still use product groups if required though), then output that language string - this should apply to the three cart configuration template pages.
  4. if you are not in any cart page, and a language override exists for that template, then output that language string - this should be all pages outside of the cart.
  5. if none of the above 4 rules match, then it defaults to using the standard format - e.g article titles in the knowledgebase, or pagetitle / company name

also, if you create an English language override, but not an equivalent Dutch string, then Dutch visitors will see the default titles.

I would have thought that meta tags would be irrelevant for the 3 cart configuration pages for SEO purposes, but you could expand the if statements used in the title block to the meta tags section if you feel that they should be added.

with regards to the language overrides themselves, they would be in the following format...

$_LANG['pagetitle']['homepage'] = 'The Home Page';
$_LANG['metakeywords']['homepage'] = 'Alpha, Beta, Delta';
$_LANG['metadescription']['homepage'] = 'This is the home page of WHMCS';
$_LANG['pagetitle']['products']['10'] = 'Shared Hosting';
$_LANG['metakeywords']['products']['10'] = 'Alpha, Beta, Delta SH';
$_LANG['metadescription']['products']['10'] = 'This is Shared Hosting';
$_LANG['pagetitle']['configureproductdomain']['45'] = 'Basic Hosting';
$_LANG['pagetitle']['viewcart'] = 'Cart Summary';
$_LANG['pagetitle']['checkout'] = 'Checkout';

so for product groups, the number in the final square brackets relates to the $gid value for that product group; for products, the number in the final square brackets is the $pid value for that product; it will make sense once you start adding them! 🙂

if you didn't want to use new language overrides in the titles, then you could do it with existing variables instead...

	{if ($gid)}
		<title>{$groupname}</title>
	{elseif ($checkout)}
		<title>{$LANG.checkout}</title>
	{elseif ($productinfo)}
		<title>{$productinfo.name}</title>	
	{elseif (!$inShoppingCart)}
		<title>{$templatefile|capitalize}</title>
	{else}
		<title>{if $kbarticle.title}{$kbarticle.title} - {/if}{$pagetitle} - {$companyname}</title>
	{/if}

obviously, I don't know what you're desired output is, but you could add {debug} to any specific template to get a list of available variables in that template and adjust your output accordingly.

I suppose if you wanted to stick exactly with the {$pagetitle} - {$companyname} format for all pages outside of the KB, you could use a ClientAreaPage hook to just set the $pagetitle variable based on $templatefile value or whatever... with a possible secondary clientareaheadoutput hook to add the meta tags for a page... though if you are deviating from the above title format in any way, you would really need to amend the titles in the template rather than via a hook.

test the above header template code thoroughly as obviously I haven't spent the time going through each and every template - so if you see any glaring issues that you can't fix with other variables, let me know. thanks.png

Link to comment
Share on other sites

  • 11 months later...

Thanks

On 1/7/2019 at 6:14 PM, brian! said:

oh it's possible in any number of ways, it just depends how thorough you need it to be, how complicated you want the code to look and what your desired output is.

that wouldn't work (but you already know that now!) - templatefile is the correct variable to use, but it equals your template name (with at least one exception), not the query strings after the question mark.

let's say that you still want to go down the multilingual route using language strings to do this as outlined in the above thread, we can expand the code to the following...


	{if ($gid && !empty($LANG.pagetitle.{$templatefile}.{$gid}))}
		<title>{$LANG.pagetitle.{$templatefile}.{$gid}}</title>
	{elseif ($checkout)}
		<title>{$LANG.pagetitle.checkout}</title>
	{elseif ($productinfo && !empty($LANG.pagetitle.{$templatefile}.{$productinfo.pid}))}
		<title>{$LANG.pagetitle.{$templatefile}.{$productinfo.pid}}</title>	
	{elseif (!$inShoppingCart && !empty($LANG.pagetitle.{$templatefile}))}
		<title>{$LANG.pagetitle.{$templatefile}}</title>
	{else}
		<title>{if $kbarticle.title}{$kbarticle.title} - {/if}{$pagetitle} - {$companyname}</title>
	{/if}
	{if ($gid && !empty($LANG.metakeywords.{$templatefile}.{$gid}))}
		<meta name="keywords" content="{$LANG.metakeywords.{$templatefile}.{$gid}}">
	{elseif ($productinfo && !empty($LANG.metakeywords.{$templatefile}.{$productinfo.pid}))}
		<meta name="keywords" content="{$LANG.metakeywords.{$templatefile}.{$productinfo.pid}}">
	{elseif (!$gid && !empty($LANG.metakeywords.{$templatefile}))}
		<meta name="keywords" content="{$LANG.metakeywords.{$templatefile}}">
	{/if}
	{if ($gid && !empty($LANG.metadescription.{$templatefile}.{$gid}))}
		<meta name="description" content="{$LANG.metadescription.{$templatefile}.{$gid}}">
	{elseif ($productinfo && !empty($LANG.metadescription.{$templatefile}.{$productinfo.pid}))}
		<meta name="keywords" content="{$LANG.metadescription.{$templatefile}.{$productinfo.pid}}">		
	{elseif (!$gid && !empty($LANG.metadescription.{$templatefile}))}
		<meta name="description" content="{$LANG.metadescription.{$templatefile}}">
	{/if}

now i've kept the code as simple as practically possible to understand and expand (no I really have!), but let me explain those 5 title if statements...

  1. if $gid exists and a language override exists for that product group, then output that language string - this should only occur with the Products template page, e.g the group categories opening page.
  2. if you are at checkout, then use the "checkout"  language override - this rule is because for both viewcart and checkout, $templatefile = "viewcart", so this allows you to distinguish between viewcart and checkout.
  3. if $productinfo exists and a language override exists for that product (could still use product groups if required though), then output that language string - this should apply to the three cart configuration template pages.
  4. if you are not in any cart page, and a language override exists for that template, then output that language string - this should be all pages outside of the cart.
  5. if none of the above 4 rules match, then it defaults to using the standard format - e.g article titles in the knowledgebase, or pagetitle / company name

also, if you create an English language override, but not an equivalent Dutch string, then Dutch visitors will see the default titles.

I would have thought that meta tags would be irrelevant for the 3 cart configuration pages for SEO purposes, but you could expand the if statements used in the title block to the meta tags section if you feel that they should be added.

with regards to the language overrides themselves, they would be in the following format...


$_LANG['pagetitle']['homepage'] = 'The Home Page';
$_LANG['metakeywords']['homepage'] = 'Alpha, Beta, Delta';
$_LANG['metadescription']['homepage'] = 'This is the home page of WHMCS';
$_LANG['pagetitle']['products']['10'] = 'Shared Hosting';
$_LANG['metakeywords']['products']['10'] = 'Alpha, Beta, Delta SH';
$_LANG['metadescription']['products']['10'] = 'This is Shared Hosting';
$_LANG['pagetitle']['configureproductdomain']['45'] = 'Basic Hosting';
$_LANG['pagetitle']['viewcart'] = 'Cart Summary';
$_LANG['pagetitle']['checkout'] = 'Checkout';

so for product groups, the number in the final square brackets relates to the $gid value for that product group; for products, the number in the final square brackets is the $pid value for that product; it will make sense once you start adding them! 🙂

if you didn't want to use new language overrides in the titles, then you could do it with existing variables instead...


	{if ($gid)}
		<title>{$groupname}</title>
	{elseif ($checkout)}
		<title>{$LANG.checkout}</title>
	{elseif ($productinfo)}
		<title>{$productinfo.name}</title>	
	{elseif (!$inShoppingCart)}
		<title>{$templatefile|capitalize}</title>
	{else}
		<title>{if $kbarticle.title}{$kbarticle.title} - {/if}{$pagetitle} - {$companyname}</title>
	{/if}

obviously, I don't know what you're desired output is, but you could add {debug} to any specific template to get a list of available variables in that template and adjust your output accordingly.

I suppose if you wanted to stick exactly with the {$pagetitle} - {$companyname} format for all pages outside of the KB, you could use a ClientAreaPage hook to just set the $pagetitle variable based on $templatefile value or whatever... with a possible secondary clientareaheadoutput hook to add the meta tags for a page... though if you are deviating from the above title format in any way, you would really need to amend the titles in the template rather than via a hook.

test the above header template code thoroughly as obviously I haven't spent the time going through each and every template - so if you see any glaring issues that you can't fix with other variables, let me know. thanks.png

Thanks

Link to comment
Share on other sites

  • 5 months later...
  • 4 months later...
	{if ($gid)}
		<title>{$groupname}</title>
	{elseif ($checkout)}
		<title>{$LANG.checkout}</title>
	{elseif ($productinfo)}
		<title>{$productinfo.name}</title>	
	{elseif ($templatefile|strstr:'store/')}
		<title>{$breadcrumb.{($breadcrumb|count)-1}.label}</title>
	{elseif ($templatefile eq "domainregister")}
		<title>{$_LANG.registerdomainname}</title>		
	{elseif ($templatefile eq "domaintransfer")}
		<title>{$_LANG.transferdomainname}</title>		
	{elseif ($templatefile eq "viewcart")}
		<title>{$_LANG.registerdomainname}</title>		
	{elseif (!$inShoppingCart)}
		<title>{$templatefile|capitalize}</title>
	{else}
		<title>{if $kbarticle.title}{$kbarticle.title} - {/if}{$pagetitle} - {$companyname}</title>
	{/if}

 

Link to comment
Share on other sites

7 minutes ago, brian! said:

	{if ($gid)}
		<title>{$groupname}</title>
	{elseif ($checkout)}
		<title>{$LANG.checkout}</title>
	{elseif ($productinfo)}
		<title>{$productinfo.name}</title>	
	{elseif ($templatefile|strstr:'store/')}
		<title>{$breadcrumb.{($breadcrumb|count)-1}.label}</title>
	{elseif ($templatefile eq "domainregister")}
		<title>{$_LANG.registerdomainname}</title>		
	{elseif ($templatefile eq "domaintransfer")}
		<title>{$_LANG.transferdomainname}</title>		
	{elseif ($templatefile eq "viewcart")}
		<title>{$_LANG.registerdomainname}</title>		
	{elseif (!$inShoppingCart)}
		<title>{$templatefile|capitalize}</title>
	{else}
		<title>{if $kbarticle.title}{$kbarticle.title} - {/if}{$pagetitle} - {$companyname}</title>
	{/if}

 

Thank you very much Mr @brian! but please is there a way to use the first solution, I mean with using new language overrides in the titles 

Link to comment
Share on other sites

  • 2 years later...
  • 4 months later...
On 1/7/2019 at 6:14 PM, brian! said:

oh it's possible in any number of ways, it just depends how thorough you need it to be, how complicated you want the code to look and what your desired output is.

that wouldn't work (but you already know that now!) - templatefile is the correct variable to use, but it equals your template name (with at least one exception), not the query strings after the question mark.

let's say that you still want to go down the multilingual route using language strings to do this as outlined in the above thread, we can expand the code to the following...

	{if ($gid && !empty($LANG.pagetitle.{$templatefile}.{$gid}))}
		<title>{$LANG.pagetitle.{$templatefile}.{$gid}}</title>
	{elseif ($checkout)}
		<title>{$LANG.pagetitle.checkout}</title>
	{elseif ($productinfo && !empty($LANG.pagetitle.{$templatefile}.{$productinfo.pid}))}
		<title>{$LANG.pagetitle.{$templatefile}.{$productinfo.pid}}</title>	
	{elseif (!$inShoppingCart && !empty($LANG.pagetitle.{$templatefile}))}
		<title>{$LANG.pagetitle.{$templatefile}}</title>
	{else}
		<title>{if $kbarticle.title}{$kbarticle.title} - {/if}{$pagetitle} - {$companyname}</title>
	{/if}
	{if ($gid && !empty($LANG.metakeywords.{$templatefile}.{$gid}))}
		<meta name="keywords" content="{$LANG.metakeywords.{$templatefile}.{$gid}}">
	{elseif ($productinfo && !empty($LANG.metakeywords.{$templatefile}.{$productinfo.pid}))}
		<meta name="keywords" content="{$LANG.metakeywords.{$templatefile}.{$productinfo.pid}}">
	{elseif (!$gid && !empty($LANG.metakeywords.{$templatefile}))}
		<meta name="keywords" content="{$LANG.metakeywords.{$templatefile}}">
	{/if}
	{if ($gid && !empty($LANG.metadescription.{$templatefile}.{$gid}))}
		<meta name="description" content="{$LANG.metadescription.{$templatefile}.{$gid}}">
	{elseif ($productinfo && !empty($LANG.metadescription.{$templatefile}.{$productinfo.pid}))}
		<meta name="keywords" content="{$LANG.metadescription.{$templatefile}.{$productinfo.pid}}">		
	{elseif (!$gid && !empty($LANG.metadescription.{$templatefile}))}
		<meta name="description" content="{$LANG.metadescription.{$templatefile}}">
	{/if}

now i've kept the code as simple as practically possible to understand and expand (no I really have!), but let me explain those 5 title if statements...

  1. if $gid exists and a language override exists for that product group, then output that language string - this should only occur with the Products template page, e.g the group categories opening page.
  2. if you are at checkout, then use the "checkout"  language override - this rule is because for both viewcart and checkout, $templatefile = "viewcart", so this allows you to distinguish between viewcart and checkout.
  3. if $productinfo exists and a language override exists for that product (could still use product groups if required though), then output that language string - this should apply to the three cart configuration template pages.
  4. if you are not in any cart page, and a language override exists for that template, then output that language string - this should be all pages outside of the cart.
  5. if none of the above 4 rules match, then it defaults to using the standard format - e.g article titles in the knowledgebase, or pagetitle / company name

also, if you create an English language override, but not an equivalent Dutch string, then Dutch visitors will see the default titles.

I would have thought that meta tags would be irrelevant for the 3 cart configuration pages for SEO purposes, but you could expand the if statements used in the title block to the meta tags section if you feel that they should be added.

with regards to the language overrides themselves, they would be in the following format...

$_LANG['pagetitle']['homepage'] = 'The Home Page';
$_LANG['metakeywords']['homepage'] = 'Alpha, Beta, Delta';
$_LANG['metadescription']['homepage'] = 'This is the home page of WHMCS';
$_LANG['pagetitle']['products']['10'] = 'Shared Hosting';
$_LANG['metakeywords']['products']['10'] = 'Alpha, Beta, Delta SH';
$_LANG['metadescription']['products']['10'] = 'This is Shared Hosting';
$_LANG['pagetitle']['configureproductdomain']['45'] = 'Basic Hosting';
$_LANG['pagetitle']['viewcart'] = 'Cart Summary';
$_LANG['pagetitle']['checkout'] = 'Checkout';

so for product groups, the number in the final square brackets relates to the $gid value for that product group; for products, the number in the final square brackets is the $pid value for that product; it will make sense once you start adding them! 🙂

if you didn't want to use new language overrides in the titles, then you could do it with existing variables instead...

	{if ($gid)}
		<title>{$groupname}</title>
	{elseif ($checkout)}
		<title>{$LANG.checkout}</title>
	{elseif ($productinfo)}
		<title>{$productinfo.name}</title>	
	{elseif (!$inShoppingCart)}
		<title>{$templatefile|capitalize}</title>
	{else}
		<title>{if $kbarticle.title}{$kbarticle.title} - {/if}{$pagetitle} - {$companyname}</title>
	{/if}

obviously, I don't know what you're desired output is, but you could add {debug} to any specific template to get a list of available variables in that template and adjust your output accordingly.

I suppose if you wanted to stick exactly with the {$pagetitle} - {$companyname} format for all pages outside of the KB, you could use a ClientAreaPage hook to just set the $pagetitle variable based on $templatefile value or whatever... with a possible secondary clientareaheadoutput hook to add the meta tags for a page... though if you are deviating from the above title format in any way, you would really need to amend the titles in the template rather than via a hook.

test the above header template code thoroughly as obviously I haven't spent the time going through each and every template - so if you see any glaring issues that you can't fix with other variables, let me know. thanks.png

This worked well for me @brian!  though I had to remove the "!" sign under !$inShoppingCart  for it to display title that are in shopping cart like domain transfer and domain registration my english.php override looked like this $_LANG['pagetitle']['domainregister'] = 'Domain registration ';  You profile:-) on lighter note though. Thanks much and God bless you in Christ Jesus!

Link to comment
Share on other sites

  • 3 months later...
  • 4 weeks later...
  • 5 months later...

Hi Everyone, The SEO Manager WHMCS addon module can help to better way to define SEO meta tags and it also adds Google verified Schema Markups for Products and Knowledgebase pages. 
its new feature Autopilot automatically adds meta tags and schema markups for products and knowledgebase Pages.
you can add SEO tags to any page either in default pages or customized pages by just entering the URL of the page.
The URL below has the SEO tags and Schema markup by this plugin Autopilot feature.

https://networkhostinggroup.com/knowledgebase/5/Linux-Shared-hosting-Getting-started.html
you can verify the schema markup at https://validator.schema.org/ website
and meta tags at https://metatags.io/ 
This Plugin is developed by the Network Hosting Group company you can buy it directly from their website. If you have a customized theme then they can help you in any manner if you have any problem. To Purchase and Download the SEO Manager Plugin click the link Below
SEO Manager For WHMCS

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated