Canonicalization happens both before and after rendering. Conflicting canonical signals between raw HTML and JavaScript output can cause unexpected indexing results. Google recommends setting the ...
Google updated its JavaScript SEO best practices document with a new section on how to set the canonial URL when using JavaScript. Google wrote, "The best way to set the canonical URL is to use HTML, ...