-
Notifications
You must be signed in to change notification settings - Fork 288
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
Canonical URLs are incorrect and limited to a single domain #426
Comments
@rosshadden @mikemurray Is this something that your routing work can/will fix? |
@aldeed No, I do not see the routing work as related to this. |
If we assume the domain of the canonical URL should always match the domain on which you visited the page, then I don't think routing need be involved. If we need to retrieve a canonical domain somewhere, then it is related to routing, but maybe only tangentially. |
In attempting to workaround this problem for To product JS near imports at top:
Then in
Then added <Helmet
title={`${product && product.title} | ${shop && shop.name}`}
meta={[{ name: "description", content: product && product.description }]}
link={[{ rel: "canonical", href: canonicalUrl }]}
script={[{ type: "application/ld+json", innerHTML: this.buildJSONLd() }]}
/> Oddly this results in a duplicate I'll report back here with my findings on the workaround for 3.1.0. UPDATE 2020-10-15: Above change indeed resolves the duplicate canonical URLs for products as reported by Google as shown here: The fix to canonical URLs shows this issue is also occurring for Tag pages, which also incorrectly show the domain root as the canonical instead of the actual page URL—a similar fix to that described above can be applied. Note, however, making this change, while it leads to more semantic pages, does not seem to have had much immediate effect on rankings in Google. |
Note for future reference this issue by way of use of |
Type: minor
Describe the bug
There are a couple problems I noticed with the current "canonical" URL/link implementation. Currently there is a
CANONICAL_URL
environment variable and this is set as the "canonical" link on every page.rel="canonical"
should be the canonical link for that specific page, not for the home page. This will negatively impact SEO since crawlers use this to avoid duplicates.CANONICAL_URL
environment variable because someone may want to serve a single instance of the app on many different URLs, potentially with different canonical URLs to go with them. Instead, the root domain for the canonical URL could come from the request URL, or could be based on the request URL but potentially overridden by routing rules.Expected behavior
The canonical URL should be page-specific and its domain should not be hard-coded.
See https://support.google.com/webmasters/answer/139066#6
If a proper fix will take time, it might actually be better to have no canonical URL for now, versus every page having the same one.
Reproduction
Go to some page other than the home page and view the
<link rel="canonical"
in thehead
. Notice that thehref
has the root URL rather than the canonical URL for the page you are on.The text was updated successfully, but these errors were encountered: