Site: search over the documentation (#60)
Site / build (pull_request) Successful in 12s

A search page whose index is the page itself: one item for each page and
each heading of the guide, the how-tos, the FAQ and the developer docs,
written by Zola from the pages' own content. A small script filters and
ranks them as you type. Nothing is fetched, so the Content-Security-Policy
needs nothing new; without JavaScript the page is a list of every heading.

The navigation gets a link, and the documentation's index pages a box that
is a plain form to /search/?q=. The devlog is not searched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EhqxQ49eCju4CzKYNjZzwT
This commit is contained in:
2026-10-07 18:50:33 +02:00
co-authored by Claude Opus 5.5
parent 5823584bfd
commit 834c6eb0f2
10 changed files with 251 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
{# One entry of the search page for each part of a page: what comes before its first heading,
then each "## heading" with what follows it. The text is the page's own, tags taken out. #}
{% macro entries(page, group) %}
{% set parts = page.content | split(pat='<h2 id="') %}
{% for part in parts %}
{% if loop.first %}
<li class="s-entry" data-group="{{ group }}"><a href="{{ page.path | safe }}">{{ page.title }}</a><span class="s-where">{{ group }}</span><p class="s-text">{{ page.description }} {{ part | striptags | trim | safe }}</p></li>
{% else %}
{% set anchor = part | split(pat='"') | first %}
{% set head = part | split(pat="</h2>") | first %}
{% set heading = head | split(pat='">') | slice(start=1) | join(sep='">') | striptags | trim %}
{% set body = part | split(pat="</h2>") | slice(start=1) | join(sep="</h2>") | striptags | trim %}
<li class="s-entry s-part" data-group="{{ group }}"><a href="{{ page.path | safe }}#{{ anchor }}">{{ heading | safe }}</a><span class="s-where">{{ group }} · {{ page.title }}</span><p class="s-text">{{ body | safe }}</p></li>
{% endif %}
{% endfor %}
{% endmacro entries %}