spartanza Posted August 23, 2018 Share Posted August 23, 2018 Hello All I am in the middle of working with an SEO and Online Marketing group for my WHMCS powered page. I am using a built-in WHMCS theme I have been tasked with adding and editing meta tags and keywords, including page titles etc. I recall once I found the specific file that handled the page title etc, but cannot recall. Additionally, I need to edit each page with keywords and meta tags but have no idea what file to edit to achieve what I would like to do. please, can you assist? I have spent two days looking for a solution and am stuck 0 Quote Link to comment Share on other sites More sharing options...
Remitur Posted August 23, 2018 Share Posted August 23, 2018 I guess you have a common header.tpl, which include the <head> section. You need to modify this file, with nested IF clause(s), in order to set desidered meta tags. I suggest to use lang variables instead of hard-coded strings for meta values (easier to manage and edit) I.E. something like this: <head> (various HEAD stuff...) {if $templatefile == 'mypage1'} <title>{$LANG.title_mypage1}</title> <meta name="keywords" content="{$LANG.meta_keywords_mypage1}" /> <meta name="description" content="{$LANG.meta_description_mypage1}" /> {/if} {if $templatefile == 'mypage2'} <title>{$LANG.title_mypage2}</title> <meta name="keywords" content="{$LANG.meta_keywords_mypage2}" /> <meta name="description" content="{$LANG.meta_description_mypage2}" /> {/if} </head> 1 Quote Link to comment Share on other sites More sharing options...
spartanza Posted August 23, 2018 Author Share Posted August 23, 2018 Perfect. Thank you 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 23, 2018 Share Posted August 23, 2018 it's worth adding that you could also use a ClientAreaHeadOutput (similar to the hook I gave you yesterday) to set titles and meta tags for each page... but @Remitur suggestion is absolutely valid too - though the use of separate If statements looks quite weird, you only need one with a lot of elses! 0 Quote Link to comment Share on other sites More sharing options...
spartanza Posted August 23, 2018 Author Share Posted August 23, 2018 5 hours ago, Remitur said: I guess you have a common header.tpl, which include the <head> section. You need to modify this file, with nested IF clause(s), in order to set desidered meta tags. I suggest to use lang variables instead of hard-coded strings for meta values (easier to manage and edit) I.E. something like this: <head> (various HEAD stuff...) {if $templatefile == 'mypage1'} <title>{$LANG.title_mypage1}</title> <meta name="keywords" content="{$LANG.meta_keywords_mypage1}" /> <meta name="description" content="{$LANG.meta_description_mypage1}" /> {/if} {if $templatefile == 'mypage2'} <title>{$LANG.title_mypage2}</title> <meta name="keywords" content="{$LANG.meta_keywords_mypage2}" /> <meta name="description" content="{$LANG.meta_description_mypage2}" /> {/if} </head> Thank you for this. I have now configured my header and my override English lang file, however, I have an issue The pages load fine, however, they are not picking up the data from the lang file. If I inspect a page I see the following info: <title>0</title> <meta name="keywords" content="0" /> <meta name="description" content="0" /> Its pulling in "0" but there is content I set the header.tpl up like you mentioned but it seems to have some kind of error? Any ideas? 0 Quote Link to comment Share on other sites More sharing options...
Remitur Posted August 24, 2018 Share Posted August 24, 2018 Debugging is always a dirty job ... 😞 I guess: 1 - you misspelled the variable name, which are different (i.e. $LANG.meta_keywords_mypage1 in TPL, and $LANG.meta_keywords_mypage1 in language override file) 2 - the condition you're checking is wrong (that's to say the right name of $templatefileis not 'mypage1' but something else, so no clause are true) 3 - there's a syntax error in language override file (i.e. the common missing final ";"), so your new language variables are not defined 4 - something else, which right now I can't think about ... 😄 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 25, 2018 Share Posted August 25, 2018 15 hours ago, Remitur said: Debugging is always a dirty job ... so true. 15 hours ago, Remitur said: 1 - you misspelled the variable name, which are different (i.e. $LANG.meta_keywords_mypage1 in TPL, and $LANG.meta_keywords_mypage1 in language override file) I think you mean $_LANG.meta_keywords_mypage1 😀 FWIW, if you were going to do this in the template, you could clean up that code... {if $templatefile eq 'homepage'} <title>{$LANG.pagetitle.homepage}</title> <meta name="keywords" content="{$LANG.metakeywords.homepage}" /> <meta name="description" content="{$LANG.metadescription.homepage}" /> {elseif $templatefile eq 'mypage2'} <title>{$LANG.pagetitle.mypage2}</title> <meta name="keywords" content="{$LANG.metakeywords.mypage2}" /> <meta name="description" content="{$LANG.metadescription.mypage2}" /> {else} <title>{if $kbarticle.title}{$kbarticle.title} - {/if}{$pagetitle} - {$companyname}</title> {/if} and then in the language override files, define the strings using 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'; if you wanted to shorten the number of if statements, you could reduce all those nested if statements down to just one by doing this... {if (!empty({$LANG.pagetitle.{$templatefile}}))} <title>{$LANG.pagetitle.{$templatefile}}</title> {if (!empty({$LANG.metakeywords.{$templatefile}}))} <meta name="keywords" content="{$LANG.metakeywords.{$templatefile}}" /> {/if} {if (!empty({$LANG.metadescription.{$templatefile}}))} <meta name="description" content="{$LANG.metadescription.{$templatefile}}" /> {/if} {else} <title>{if $kbarticle.title}{$kbarticle.title} - {/if}{$pagetitle} - {$companyname}</title> {/if} this basically works by checking whether there is a language string for the current template page - if there is, it uses that for the title and and then checks whether there are meta tags/description strings too and if so, outputs them... if there is no language string for the current template file, then it defaults to the usual output of using $pagetitle and $companyname (except for kb articles)... you could make title/keywords & description all independent of each other, just by a slight rearrangement of the if statements, if there are circumstances in which you want to leave the title alone, but add meta details to a page. one advantage of this method is that you wouldn't necessarily need to add language strings for all languages or templates... only those languages/templates that you want to change. 2 Quote Link to comment Share on other sites More sharing options...
Jade D Posted November 10, 2018 Share Posted November 10, 2018 Howdy @brian! Thanks for posting this. Would you be able to advise on how to display and customize meta related content for product pages, and for knowledge base pages add the tags defined to the knowledge base article as keywords? 0 Quote Link to comment Share on other sites More sharing options...
MYGSG - Nicholas S Posted November 11, 2018 Share Posted November 11, 2018 @spartanza @Jade D, There is a WHMCS module from @zomexand WHMCS Themes that does this, WHMCS Themes is called "SEO Manager" and Zomex is a page template you pay for called "SEO Enhancer". I am using the module from WHMCS Themes and it's working great. I found this to be the easiest fix for handling SEO. All the best. Kindest Regards, Nick. 0 Quote Link to comment Share on other sites More sharing options...
Jade D Posted November 11, 2018 Share Posted November 11, 2018 Thanks for the response @RLT - Nicholas - I did initially look at the @zomex seo enhancer but couldnt confirm via their website if it would work for knowledge base articles. Most of the mods that I have seen / reviewed only apply to whmcs pages which is not what I am looking for. Ideally two areas need to be corrected within whmc's code and those are the product specific pages and knowledge base articles. Perhaps zomex can provide feedback and confirm if their seo enhancer will work for product pages and knowledge base articles? Google is penalizing us for the duplicate content within these sections. Lastly, I've used themes before and whilst they are great they land up causing more grey hairs than what they are worth if you're using third party modules so I prefer to use six and customize the existing css. 95% of wordpress developers use six within their testing and this works. 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted November 11, 2018 Share Posted November 11, 2018 Stop stressing out with keyword meta tag. It's worth nothing since more than 12 years! And for duplicate content, there's no need to do crazy things. Just use canonical meta tag. When you use it on your page, it doesn't matter how many different URLs bring visitors to that page. The only valid URL will be the canonical one. 0 Quote Link to comment Share on other sites More sharing options...
zomex Posted November 15, 2018 Share Posted November 15, 2018 On 11/11/2018 at 10:12 AM, Jade D said: Thanks for the response @RLT - Nicholas - I did initially look at the @zomex seo enhancer but couldnt confirm via their website if it would work for knowledge base articles. Most of the mods that I have seen / reviewed only apply to whmcs pages which is not what I am looking for. Ideally two areas need to be corrected within whmc's code and those are the product specific pages and knowledge base articles. Perhaps zomex can provide feedback and confirm if their seo enhancer will work for product pages and knowledge base articles? Google is penalizing us for the duplicate content within these sections. Lastly, I've used themes before and whilst they are great they land up causing more grey hairs than what they are worth if you're using third party modules so I prefer to use six and customize the existing css. 95% of wordpress developers use six within their testing and this works. Hello there, Unfortunately our SEO Enhancer module won't support knowledgebase articles. The reason for this is because in WHMCS there is no way to detect single articles at least in the way used by the module (using the templatefile variable). Thanks, Jack 0 Quote Link to comment Share on other sites More sharing options...
Ebin V Thomas Posted October 4, 2022 Share Posted October 4, 2022 How to fix all "Meta Description tag missing" errors in KB by bulk. can anyone suggest 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.