lazysite supports client-side search via a JSON index generated by
api: true + scan:. Pages opt in or out of search via front matter.
The search UI loads the index once and queries it entirely in the browser.
By default all pages are searchable (when search_default: true in
lazysite.conf). Exclude a page:
---
title: Draft Post
search: false
---
Include a page explicitly (useful when site default is false):
---
title: Published Post
search: true
---
Set in lazysite/lazysite.conf:
search_default: true
When not set, defaults to true (pages are searchable).
Create public_html/search-index.md. The /**/*.md pattern
recursively scans all subdirectories:
---
title: Search Index
api: true
content_type: application/json; charset=utf-8
search: false
ttl: 3600
tt_page_var:
all_pages: scan:/**/*.md filter=searchable:true sort=date desc
---
[% USE JSON.Escape %]
[% all_pages.json %]
Requires libtemplate-plugin-json-escape-perl (Debian/Ubuntu).
Create public_html/search-results.md with query_params: [q].
The starter site includes a complete reference implementation with
weighted scoring, term highlighting, and tag filtering. The search
box in the site bar or view template submits to
/search-results?q=term.
The ttl: 3600 on the search index controls both server-side cache
lifetime and the browser Cache-Control: public, max-age=3600
header. The browser caches the JSON for up to one hour.
excerpt
for client-side snippet extractionsearch: false
to exclude themselves from the index