The discussion explores how to replicate and analyze what Googlebot sees when crawling Discourse forums. networkaaron outlines a method using Chrome DevTools to simulate Googlebot’s behavior by setting the user agent to Googlebot Smartphone, then inspecting the rendered HTML. The key insight is that Googlebot crawls the initial HTML and then renders it in a headless browser, allowing JavaScript-generated content to appear in the final indexed DOM. j127 suggests using curl with the appropriate Googlebot user agent to fetch the raw HTML, which may differ from what a regular browser sees. david questions the purpose of the Chrome rendering step, noting that copying the outerHTML directly from the crawled page might suffice. networkaaron clarifies that the rendered DOM is crucial because it reflects the content Googlebot indexes, especially in JavaScript-heavy sites. The thread emphasizes the importance of ensuring that critical content and links are present in the rendered output for proper SEO.
The cached HTML is rendered in Chrome (headless). When rendered, supplemental copy and links may be introduced via JavaScript, in the dom. Google will take the information it renders into consideration for indexing.
This is how Googlebot gets content from JavaScript-heavy applications. Go to Google and search for something you know renders content only with JavaScript > click the 3 dotted icon > click the Cached button > click View source > copy it and render it in Chrome to see what content appears in the dom.
Note: Update any relative paths (CSS and JS resources) to absolutes before rendering it in Chrome ^^
Make sure to include the Googlebot user agent string, e.g., Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html). The server may send Googlebot different HTML.
I think it’s the same output, but it doesn’t hurt to add the user agent. I’m not sure about Chrome, but in Firefox you can right-click on the request in the network tab and choose “copy as curl” for a complete set of headers that will mimic a browser request.