Skip to content
This repository has been archived by the owner on Jan 29, 2024. It is now read-only.

Commit

Permalink
remove admonition and add condition subtitle to max 160 chars
Browse files Browse the repository at this point in the history
  • Loading branch information
angelinekwan committed Aug 1, 2023
1 parent a2435d5 commit b83a960
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/index_algolia.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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',
Expand Down

0 comments on commit b83a960

Please sign in to comment.