Files
indiekit-blog/search.njk
Ricardo e5d699cffc fix: use Pagefind 1.x path and exclude non-HTML files from index
Update Pagefind asset URLs from /_pagefind/ to /pagefind/ to stop
the pre-1.0 compatibility mode that was writing the index twice.
Also ignore CLAUDE.md and README.md in Eleventy to prevent them
from being processed into HTML pages without an <html> element.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 13:54:51 +01:00

40 lines
1.0 KiB
Plaintext

---
layout: layouts/base.njk
title: Search
permalink: /search/
eleventyExcludeFromCollections: true
pagefindIgnore: true
---
<div class="page-header mb-6 sm:mb-8">
<h1 class="text-2xl sm:text-3xl font-bold text-surface-900 dark:text-surface-100 mb-2">Search</h1>
<p class="text-surface-600 dark:text-surface-400">Search across all posts, articles, notes, and pages.</p>
</div>
<link rel="stylesheet" href="/pagefind/pagefind-ui.css">
<div id="search"></div>
<script src="/pagefind/pagefind-ui.js"></script>
<script>
window.addEventListener("DOMContentLoaded", () => {
const ui = new PagefindUI({
element: "#search",
showSubResults: true,
showImages: false,
});
// Support ?q= query parameter
const params = new URLSearchParams(window.location.search);
const query = params.get("q");
if (query) {
ui.triggerSearch(query);
}
// Auto-focus the search input
const input = document.querySelector("#search input[type='text']");
if (input && !query) {
input.focus();
}
});
</script>