Jump to content

Enquiry on Canonical URL via ClientAreaHeadOutput


pikerr

Recommended Posts

Dear All,

I have quite a lot of duplicate content ever since I have enabled the currency options in WHMCS.  It appears in announcement, checkout, index, cart, contact, submitticket, supportticket etc.

I wonder if can use ClientAreaHeadOutput to set canonical tag.

For example, Im looking at the below links (WHMCS installation folder is https://example.com/client)

https://example.com/client/index.php?rp=%2Fannouncements%2F3%2FCompleted-Migration-of-Physical-Assets-in-Chicago-Data-Center.html&currency=1

https://example.com/client/index.php?rp=%2Fannouncements%2F2%2FImportant-Announcement-Migration-of-Physical-Assets-in-Chicago-Data-Center.html&currency=10

I have tried to create ClientAreaHeadOutput hooks however it does not work , any advice?

add_hook('ClientAreaHeadOutput', 1, function($vars)
{
    $SystemURL = 'https://example.com/client';
    $Page = 'whatever';

    return <<<HTML
    <link rel="canonical" href="https://{$SystemURL}/{$Page}"/>
HTML;

});

 

 

Thank you

Edited by WHMCS ChrisD
Removed link at posters request
Link to comment
Share on other sites

Dear Kian,

 

Just to confirm,  since $SystemURL = 'https://example.com/client';    

Is there a need to write href="https://{$SystemURL}/{$Page}"/> 

will it be a duplicate of https:// ?

I have saved this hook in /includes/hooks /canonicaltag.php  . This should work ?

And advice?

Thank you

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