
"The rel="canonical" link tag helps Google find the canonical version of a page. You can use JavaScript to set the canonical URL, but keep in mind that you shouldn't use JavaScript to change the canonical URL to something else than the URL you specified as the canonical URL in the original HTML. The best way to set the canonical URL is to use HTML, but if you have to use JavaScript, make sure that you always set the canonical URL to the same value as the original HTML. If you can't set the canonical URL in the HTML, then you can use JavaScript to set the canonical URL and leave it out of the original HTML."
"Canonicalization happens before and after rendering, so it's important to make the canonical URL as clear as possible. With JavaScript, this means setting the canonical URL to the same URL as in the original HTML or if that isn't possible, to leave the canonical URL out of the original HTML."
"Always test to make sure Google can process your JavaScript and one way to do that is to test it using the URL Inspection tool in Google Search Console."
Use the rel="canonical" link tag to indicate the canonical version of a page. Prefer setting the canonical URL in the HTML rather than using JavaScript. If JavaScript must set the canonical, ensure it matches the value specified in the original HTML and never change it to a different URL. If the canonical cannot be set in HTML, omit the canonical from the HTML and set it via JavaScript. Canonicalization runs before and after rendering, so make the canonical URL explicit. Test that Google can process your JavaScript, for example with the URL Inspection tool in Google Search Console.
Read at Search Engine Roundtable
Unable to calculate read time
Collection
[
|
...
]