-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
URGENT: canonical link does not take into account any actions / ids / getvariables #67
Comments
Hi @sunnysideup! I think you make a good point! However I also think that often people would NOT want all the query params passed into the canonical link. So perhaps this should be configurable. Offhand, I see two logical ways to handle it...
Which makes the most sense for you? |
Thank you for your swift and kind reply. This is the real issue I see: this is supposed to be an SEO module and it does many great things, but the end result is actually that you end up potentially reducing your SEO visibility, byby a lot, without realising it. It is a very common pattern to use /URSegment(s)/Action/ID for any type of listing (i.e. anytime you would like to make a dataobject visible as a page). With this canonical url method, you link all of these back to the main page (URLSegment). In my books, we use canonical urls to standardise the domain name, to standardise the language qualifier, etc.... What I did in my metatags module is that I said: if you have a That is, you only need canonical links to fix something, not the other way around. So - in other words, I would recommend that your otherwise rather excellent module would let the developer set a canonical link if needed rather than assuming they need one. Here is my temporary fix in Page.php... Obviously a hack, but I like using The good news that Google still indexes the pages, but when showing them in the search results, it links it to the parent page, meaning that users do not find what they need. public function MetaTags($includeTitle = true)
{
$tagString = parent::MetaTags($includeTitle);
$tagString = str_replace('<link rel="canonical" href=', '<meta name="parentpage" content=', $tagString);
if(! empty($_SERVER['REQUEST_URI'])) {
$tagString .= PHP_EOL.'<link rel="canonical" href="'.Controller::join_links(Director::absoluteBaseURL(), $_SERVER['REQUEST_URI']).'"/>';
}
return $tagString;
} |
The current implementation for the canonical link is not so good, because it removes any actions / ids / getvariables that often are an integral part of a page (e.g.
www.e-commerce.com/products/show/12?version=3
).From what I can see, you could change this by changing the AbsoluteLink for a page, but that may have all sorts of other consequences.
The text was updated successfully, but these errors were encountered: