Overview
Blog posts need searchable content. Users expect to find posts by keyword. Two main approaches:
Option A: Client-side search (lunr.js / Pagefind)
- Generate a search index JSON at content scan time
- Serve at
/search-index.json
- Client-side JavaScript library (lunr.js, Pagefind, Fuse.js) does the search
- Pros: No server load, works with CDN, offline-capable
- Cons: Requires JavaScript (currently none), index size grows with content, initial page load penalty
- BlogFlow fit: Contradicts "no JavaScript required" philosophy in current CSS
Option B: Server-side search (bleve / built-in)
- In-memory search index built during content scan (bleve or simple inverted index)
GET /search?q=keyword returns matching posts
- Pros: No JS required, fast, server-controlled ranking
- Cons: Memory overhead, not cached by CDN, adds server complexity
- BlogFlow fit: Aligns with server-rendered philosophy
Option C: Pagefind (static, no runtime JS framework)
- Pagefind generates a search index + tiny UI widget at build time
- Works with static HTML output
- Pros: Lightweight (~6KB), works without framework, good UX
- Cons: Still requires JS execution, needs post-scan index generation step
Requirements (regardless of approach)
- Search by title, tags, and body content
- Results show title, excerpt, date, relevance score
- Handles Unicode content (matches urlize i18n work)
- Configurable:
search.enabled: true in site.yaml
- Accessible: keyboard-navigable results
Open questions
- Does search fit BlogFlow's "just add markdown" simplicity?
- Is JS acceptable in the default theme, or should search be opt-in via theme override?
- Should we support search in the embedded defaults theme or only in custom themes?
Overview
Blog posts need searchable content. Users expect to find posts by keyword. Two main approaches:
Option A: Client-side search (lunr.js / Pagefind)
/search-index.jsonOption B: Server-side search (bleve / built-in)
GET /search?q=keywordreturns matching postsOption C: Pagefind (static, no runtime JS framework)
Requirements (regardless of approach)
search.enabled: truein site.yamlOpen questions