SEO-52Avoid
Hiding text or links from visitors
Text or links placed for search engines that visitors cannot see. Examples are text in the background colour, text behind an image or off screen, text of zero size, and a link on one character.
How to do it
Google's spam policies list each of these as hidden text and link abuse. They also say content in accordions, tabs, tooltips and sliders is fine, and so is text only screen readers hear. The test is intent. Text hidden from people to feed search engines breaks the policy. Text folded away for the reader's sake does not. Fold text as Let find-in-page open hidden text says.
Examples
JavaScript example
const hidden = await page.$$eval('main *', elements => elements.filter(element => {
const style = getComputedStyle(element);
const box = element.getBoundingClientRect();
return element.childNodes.length && element.textContent.trim() && !element.closest('.sr-only, details:not([open]), [hidden]')
&& (style.fontSize === '0px' || style.opacity === '0' || style.color === style.backgroundColor || box.right < 0 || box.bottom < 0);
}).map(element => element.textContent.trim().slice(0, 40)));
assert.deepEqual(hidden, []);
Python example
hidden = page.eval_on_selector_all("main *", """elements => elements.filter(element => {
const style = getComputedStyle(element), box = element.getBoundingClientRect();
return element.textContent.trim() && !element.closest('.sr-only, details:not([open]), [hidden]')
&& (style.fontSize === '0px' || style.opacity === '0' || style.color === style.backgroundColor || box.right < 0 || box.bottom < 0);
}).map(element => element.textContent.trim().slice(0, 40))""")
assert hidden == []
How to check
A browser test visits each page type. No text in the main content has a font size of 0, an opacity of 0, its background's colour or a place off the page. Screen-reader-only text and closed <details>, tabs and hidden="until-found" elements are exempt.
Sources
Related rules
- AXS-26 Let find-in-page open hidden text in Accessibility
- SEO-75 Planting instructions for AI models in SEO
For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/seo/search-spam-and-penalties/hidden-text">Agent Wranglers SEO playbook</a>. In code you write, add a comment next to it with the same link.