mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-25 05:09:03 -05:00
feat: pass the Starlight gate on dense pages
Pages of cards under one or two headings drop the table of contents, whose script watched every block of a 400-card page: 2 x 430 ms of main thread on a throttled phone. Tables are measured once the page is idle, skipping those in closed blocks, so a scrolling table is a tab stop anywhere on the page. The 12 heaviest pages score 97 to 100 in Lighthouse mobile, axe reports nothing on 16 pages in both themes, and the search answers the ten gate queries.
This commit is contained in:
1 parent
bcade3dc9b
commit
abe240073c
4 files changed
+27
-4
No files matched your search
@@ -1,6 +1,6 @@
|
||||
"""The site as an Astro Starlight project: pages, sidebar and data files.
|
||||
|
||||
generate_site.py writes each page body; this module gives it the form
|
||||
generate_site.py writes each page body, and this module gives it the form
|
||||
Starlight reads. A page's links are written as the docs tree holds them
|
||||
(``../systems/sony.md``, MkDocs' convention, the one a Markdown editor
|
||||
follows), and the site serves them as addresses under /retrobios/, so
|
||||
@@ -397,7 +397,12 @@ def finalize_page(
|
||||
if boost:
|
||||
front["boost"] = boost
|
||||
if rel.startswith(CARD_PAGES):
|
||||
front["tableOfContents"] = {"minHeadingLevel": 2, "maxHeadingLevel": 2}
|
||||
sections = len(re.findall(r"^## ", body, re.M))
|
||||
# A page of cards under one or two headings has nothing to list, and
|
||||
# the table of contents watches every block of the page to follow
|
||||
# the reader: 2 x 430 ms of a phone's main thread on 400 cards.
|
||||
front["tableOfContents"] = (
|
||||
{"minHeadingLevel": 2, "maxHeadingLevel": 2} if sections > 2 else False)
|
||||
if not search:
|
||||
front["pagefind"] = False
|
||||
front["head"] = page_head(rel, level, front["title"], browser_title, structured)
|
||||
|
||||
Reference in new issue
Block a user