Jump to content

Hook for rel canonical in header


Recommended Posts

49 minutes ago, bear said:

That will deliver "whatever" to all the pages. How will it grab the page it's on, which is what he seems to be asking?

EDIT: "filename" might do that.

Nah, $vars['filename'] is the name of the tpl file that most of the times doesn't match page name. For example clientareahome refers to clientarea.php. Not to mention that ".php" is missing.

Anyway I have intentionally avoided to specify $Page because it's more complicated than it seems. In fact there's no point in just placing the canonical URL that always matches current page name since Search Engines already know what's the URL to index. The use of canonical URL is to let them know on what URL of the page they must focus. There are some pages of WHMCS that are accessible from multiple URLs even though they provide the same content. That's duplicate content. Some other are exploitable if someone wants to hurt your indexing like in the following example:

  • index.php?rp=/knowledgebase/1/real-news.html
  • index.php?rp=/knowledgebase/1/real-news-yo.html
  • index.php?rp=/knowledgebase/1/real-news-yo-yo.html
  • index.php?rp=/knowledgebase/1/real-news-yo-yo-yo.html.

4 URLs for the same page 3 of which are fake. Incoming duplicate content penalties. That's where canonical URL helps you. Making it always equal to your domain followed by the query string is a waste of time. You can't trust the URL in the address bar.

Edited by Kian
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