fix: keep the date and Next steps out of search

A query word matches the start of a longer word. Since the index grew,
the "2" of "playstation 2 bios" matched the 2026 of every page's date
line and the "u" of "wii u bios" the "use" of Next steps, so the
PlayStation and Nintendo pages held every query word and ranked above
the PlayStation 2 and Wii U pages. Both blocks carry
data-pagefind-ignore now: search_gate answers 58 of 58 queries, the
four console pairs by 9 to 14 percent. Batocera's pages weigh 882
bytes more for it.
This commit is contained in:
Abdessamad Derraz committed 2026-11-10 08:41:03 +01:00
1 parent 25057ee3a2
commit f7a0a7f263
3 files changed
+16 -5

No files matched your search

+5
View File
@@ -577,6 +577,11 @@ def finalize_page(
# is a name, and stays: it is how "neogeo.zip" finds the cores reading it.
body = re.sub(r'<span class="(rb-badge(?![^"]*rb-badge-archive)[^"]*)"',
r'<span data-pagefind-ignore class="\1"', body)
# "Next steps" closes most pages with the same links ("for the setup in
# use"): the "u" of "wii u bios" matched the start of "use" there, and
# the Nintendo page came before the Wii U page.
body = _NEXT_STEPS.sub(
lambda match: f"<div data-pagefind-ignore>\n\n{match[0].rstrip()}\n\n</div>\n\n", body, count=1)
if rel.startswith("systems/"):
body += file_names_meta(body) + search_field("aliases", page_aliases(rel))
consoles = field_words(authored.get("consoles"))