vittyc Posted January 4, 2019 Share Posted January 4, 2019 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 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 4, 2019 Share Posted January 4, 2019 13 minutes ago, vittyc said: Can anyone recommended a plugin or a tutorial on how to get around this please? if you wanted to edit the header template, you could follow the post below as a starting point... 0 Quote Link to comment Share on other sites More sharing options...
vittyc Posted January 4, 2019 Author Share Posted January 4, 2019 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 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 4, 2019 Share Posted January 4, 2019 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 ?? 0 Quote Link to comment Share on other sites More sharing options...
vittyc Posted January 6, 2019 Author Share Posted January 6, 2019 Yeah if that's possible....? 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... 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted January 7, 2019 Share Posted January 7, 2019 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... 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. 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. 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. 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. 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. 3 Quote Link to comment Share on other sites More sharing options...
vittyc Posted January 8, 2019 Author Share Posted January 8, 2019 That's brilliant, thanks! 🙂 0 Quote Link to comment Share on other sites More sharing options...
Maraby Posted December 14, 2019 Share Posted December 14, 2019 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... 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. 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. 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. 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. 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 0 Quote Link to comment Share on other sites More sharing options...
isixhosting Posted May 21, 2020 Share Posted May 21, 2020 (edited) On 1/7/2019 at 4:14 PM, brian! said: Works perfectly!!! Edited May 21, 2020 by isixhosting 0 Quote Link to comment Share on other sites More sharing options...
Samra Posted September 23, 2020 Share Posted September 23, 2020 Hello, please how to have this work for those URL located in child menu under Store : client/cart.php?a=add&domain=register cart.php?a=add&domain=transfer cart.php?a=view 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 25, 2020 Share Posted September 25, 2020 {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} 0 Quote Link to comment Share on other sites More sharing options...
Samra Posted September 25, 2020 Share Posted September 25, 2020 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 0 Quote Link to comment Share on other sites More sharing options...
Martin Soluce Posted December 5, 2022 Share Posted December 5, 2022 @Brian After whmcs 8.6.1 what is the best option to add meta title, description, twitter card? 0 Quote Link to comment Share on other sites More sharing options...
gsina Posted April 28, 2023 Share Posted April 28, 2023 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... 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. 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. 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. 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. 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. 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! 0 Quote Link to comment Share on other sites More sharing options...
Martin Soluce Posted August 25, 2023 Share Posted August 25, 2023 @brian! Everyone looking at you for the best optimised SEO Title for Latest ver 8.7.3? the $gid options no more working. 0 Quote Link to comment Share on other sites More sharing options...
RubixVi Posted September 16, 2023 Share Posted September 16, 2023 There are plugins already out there that has fine control over the SEO information. 0 Quote Link to comment Share on other sites More sharing options...
Saroha Posted February 26 Share Posted February 26 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 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.