diff --git a/scripts/index_algolia.py b/scripts/index_algolia.py index ce4cf2f5d9..ee6563ad37 100644 --- a/scripts/index_algolia.py +++ b/scripts/index_algolia.py @@ -38,6 +38,10 @@ def parse_pages(html_build_dir): title = h1.text.strip() h1.decompose() + # remove admonition + for admonition in elements.select('div.admonition'): + admonition.decompose() + # Extract text from the first p tag and remove it for first_p in elements.select('p'): subtitle = first_p.text.strip() @@ -62,7 +66,7 @@ def parse_pages(html_build_dir): body = elements.text.strip() pages.append({ 'title': title, - 'subtitle': subtitle, + 'subtitle': subtitle[:160] + '...' if len(subtitle) > 160 else subtitle, 'body': body, 'slug': full_path, 'facetingType': 'documentation',