diff --git a/readthedocs/search/parsers.py b/readthedocs/search/parsers.py index 5c7edb366fc..b4dacae8af3 100644 --- a/readthedocs/search/parsers.py +++ b/readthedocs/search/parsers.py @@ -166,11 +166,13 @@ def _clean_body(self, body): This will mutate the original `body`. """ - # Remove all navigation nodes nodes_to_be_removed = itertools.chain( + # Navigation nodes body.css('nav'), body.css('[role=navigation]'), body.css('[role=search]'), + # Permalinks + body.css('.headerlink'), ) for node in nodes_to_be_removed: node.decompose() diff --git a/readthedocs/search/tests/data/sphinx/in/page.html b/readthedocs/search/tests/data/sphinx/in/page.html index 353d43be343..db00c71d171 100644 --- a/readthedocs/search/tests/data/sphinx/in/page.html +++ b/readthedocs/search/tests/data/sphinx/in/page.html @@ -17,6 +17,17 @@
This is a H3 title.
+ + + diff --git a/readthedocs/search/tests/data/sphinx/out/page.json b/readthedocs/search/tests/data/sphinx/out/page.json index 4bc1e0552a9..121dca89052 100644 --- a/readthedocs/search/tests/data/sphinx/out/page.json +++ b/readthedocs/search/tests/data/sphinx/out/page.json @@ -28,7 +28,7 @@ "content": "Sphinx configuration file used to build this docs: # -*- coding: utf-8 -*- # Default settings project = 'Test Builds' extensions = [ 'sphinx_autorun', ] latex_engine = 'xelatex' # allow us to build Unicode chars # Include all your settings here html_theme = 'sphinx_rtd_theme' >>> # Build at >>> import datetime >>> datetime.datetime.utcnow() # UTC datetime.datetime(2020, 5, 3, 16, 38, 11, 137311)" }, { - "content": "This is a H3 title.", + "content": "This is a H3 title. Fig. 4 I'm a figure!", "id": "subsub-title", "title": "Subsub title" }