Skip to main content

Trace a robots tag that moves into body

Glot Rank Team · Published

Save both observations when response HTML places a robots tag in head but Elements shows it in body. HTML parsing or scripts may explain the difference. A plugin reporting indexability does not establish Google’s indexed state.

Glenn Gabe’s migration investigation documented moving tags, then updated the diagnosis with a script conflict and Google’s feedback about the original markup. That 2018 account does not establish that every moved tag becomes ineffective. Its useful lesson is how the diagnosis changed with evidence.

Preserve three observations of the same URL

Confirm the owner-approved indexing policy first. Choose an affected page and an apparently unaffected page using the template. Record browser, date, access conditions and final address.

ObservationWhere to obtain itWhat it cannot establish
Response HTML and headersNetwork document requestEvery later script state
Current DOMElements and actual parent nodeGoogle’s historical indexed state
GSC recordURL Inspection with crawl timeIdentical behavior on every present request

Record X-Robots-Tag separately. One HTML tag is not the entire policy.

List declarations and their locations

Use this read-only Console query on the approved test page:

[
  ...document.querySelectorAll(
    'meta[name="robots" i], meta[name="googlebot" i]',
  ),
].map((node) => ({
  name: node.name,
  content: node.content,
  parent: node.parentElement?.tagName,
}));

It excludes response headers and other crawler-specific declarations. Preserve counts and locations, then compare them with the original response rather than treating the selector as a complete access-policy scanner.

Separate parsing from script execution

In development, open Chrome DevTools and its Command Menu with Control+Shift+P, or Command+Shift+P on Mac. Run Disable JavaScript, reload and save the DOM. Keep DevTools open, run Enable JavaScript and reload again before repeating the same observations. Browsers repair document structure even without JavaScript. A difference from the source file alone does not identify a script as the cause.

If the movement occurs without scripts, inspect invalid head elements, early closure and template output. If it appears only after execution, set a DOM-change breakpoint and inspect callers using the canonical mutation workflow.

Reproduce on a defined template before blaming the entire CMS. Gabe’s investigation also used other implementations to narrow the explanation.

Preserve the policy while repairing the implementation

URL, approved indexing policy and owner:
Headers, response HTML, no-script DOM and scripted DOM:
First step producing a difference:
Affected and comparison templates:
Located markup, component or script:
Repair scope, version, rollback and public-response verification:

Check valid placement and combined directives against Google’s robots-meta specification. Do not remove an intentional noindex merely to silence a tool.

Verify implementation before claiming recovery

Retest direct entry, reload, consent-state changes and client navigation. Sample shared templates. Pages intended to remain excluded must still satisfy that policy; public pages need a check for accidental restrictions.

A repaired DOM is an implementation outcome. Add new indexed evidence when available rather than describing local markup correctness as recovered traffic.