- Class
- C2 Recommended
- Weight
- 4
- Severity on fail
- major
- Applies to
Scope and evidence
Evaluated on page (P). The book marks this requirement DOCUMENTED RECOMMENDATION, SEARCH-ENGINE-SPECIFIC. It needs rendered; without that input the rule reports as not evaluated rather than guessing.
Fail conditions
Each condition has a stable code and a reason template. The evaluator fills the placeholders from observed values only; no sentence in a report is generated.
canonical_added_by_jsOn {url}, the canonical ({rendered}) exists only after JavaScript runs. Google says the best way to set the canonical URL is to use HTML.
canonical_changed_by_jsOn {url}, JavaScript changes the canonical from {raw} to {rendered}. Google says that if JavaScript must set the canonical, it should always be the same value as in the original HTML.
The documented fix
Render the canonical on the server and leave it unchanged in the client.
Sources, quoted
These are the passages the rule rests on, stored once in the knowledge base and emitted exactly as written. A citation marked for specific conditions appears only on findings with those codes.
“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.”
[G-JS] Understand the JavaScript SEO basics · Set the canonical URL · last updated 2026-03-04
https://developers.google.com/search/docs/crawling-indexing/javascript/javascript-seo-basics