AddonsConfig.options_root_selector lets a project tell us where its main content is — "CSS selector for the main content of the page. Leave it blank for auto-detect." We only send it to the addons client.
The server-side parser ignores it. GenericParser._get_main_node() in readthedocs/search/parsers.py always auto-detects: [role=main], then <main>, then the first <h1>'s parent, then <body>.
So a project that set the selector because auto-detect picks the wrong node still gets indexed for search, and hashed for the file tree diff, from the node it told us not to use.
Honoring it is a few lines, self.project is already available there. Two things to know before doing it: it changes search results for those projects, not just their file tree diff, and it re-hashes every page of each affected project once — their next PR preview reports every file as modified until the base version is built again.
🤖 Generated with Claude Code
AddonsConfig.options_root_selectorlets a project tell us where its main content is — "CSS selector for the main content of the page. Leave it blank for auto-detect." We only send it to the addons client.The server-side parser ignores it.
GenericParser._get_main_node()inreadthedocs/search/parsers.pyalways auto-detects:[role=main], then<main>, then the first<h1>'s parent, then<body>.So a project that set the selector because auto-detect picks the wrong node still gets indexed for search, and hashed for the file tree diff, from the node it told us not to use.
Honoring it is a few lines,
self.projectis already available there. Two things to know before doing it: it changes search results for those projects, not just their file tree diff, and it re-hashes every page of each affected project once — their next PR preview reports every file as modified until the base version is built again.🤖 Generated with Claude Code