top of page
  • Writer's pictureBrent D. Payne

Canonical only in the rendered HTML

The webpage URL being analyzed has a canonical tag that appears solely in the rendered HTML—this element is absent in the raw HTTP response HTML.


Why is this important?

The process of rendering a webpage demands considerable resources and time than fetching the direct source HTML. Google employs a dual-phase crawling method: initially inspecting the HTML response and subsequently analyzing the web page upon rendering. Google's index is updated after the second review, considering the rendered HTML.


Therefore, it isn't optimal to offer dissimilar directives for indexing within both the untouched and rendered HTML (such as meta robots, canonical, hreflang, and so on).


Google explicitly advises against using JavaScript to insert canonical tags. Ensure the canonical tag's inclusion within the initial server response HTML to be assured of Google's recognition and adherence to it.


What does the Optimization check?

The check is activated for any internal URL where a canonical tag surfaces in the rendered HTML but is missing from the initial response HTML.


Examples that trigger this Optimization

Any URL that features a canonical link in the executed HTML's <head> section, which wasn't part of the server's response HTML, will prompt this Optimization.


Consider this scenario for the server's response HTML:

<!doctype html><html lang="en">  <head>    <meta name="robots" content="index,follow">    ...  </head>  <body>...</body></html>


Contrast with the executed HTML, which would be:

<!doctype html><html lang="en">  <head>    <meta name="robots" content="index,follow">    <link rel="canonical" href="https://example.com" />    ...  </head>  <body>...</body></html>


How do you resolve this issue?

Google affirms that a rendered canonical does not influence indexing, so depending on it for indexing would not be a sensible strategy. The ideal methodology is to secure the canonical's presence in the source HTML without alterations throughout the rendering phase. Google cautions that if injecting canonical tags via JavaScript is absolutely necessary, it should be accomplished in a specific manner.


Further Reading

5 views

Commentaires


bottom of page