
Security News
GPT-6 Astra Attempts Supply Chain Attacks Against Open Source Maintainers in Testing
GPT-6 Astra hits 100% on ExploitBench and finds zero-days autonomously, while independent tests reveal scope violations and monitoring gaps.
eleventy-plugin-search
Advanced tools
Early Development Notice: This plugin is under active development. The API may change before reaching v1.0.0. Please report issues and feedback on GitHub.
HTML-first Eleventy search plugin with Fuse.js and Cheerio. Processes final rendered HTML files after templates for accurate search indexing.
DEBUG=Eleventy:searchnpm install eleventy-plugin-search
Add the plugin to your Eleventy configuration:
// eleventy.config.js
import searchPlugin from 'eleventy-plugin-search';
export default function (eleventyConfig) {
eleventyConfig.addPlugin(searchPlugin, {
// Options (all optional)
indexPath: 'search-index.json',
excludeSelectors: ['nav', 'header', 'footer']
});
}
The plugin runs after Eleventy builds your site and creates a search-index.json file in your output directory.
| Option | Type | Default | Description |
|---|---|---|---|
pattern | string | '**/*.html' | Glob pattern for HTML files to process |
ignore | string | string[] | ['**/search-index.json'] | Files to exclude from indexing |
indexPath | string | 'search-index.json' | Output path for the search index |
excludeSelectors | string[] | ['nav', 'header', 'footer'] | CSS selectors to remove before extraction |
maxContentLength | number | 10000 | Maximum characters of content to index |
fuseOptions | object | See below | Fuse.js configuration |
{
keys: [
{ name: 'title', weight: 10 },
{ name: 'content', weight: 5 },
{ name: 'excerpt', weight: 3 }
],
threshold: 0.3,
includeScore: true,
includeMatches: true,
minMatchCharLength: 3
}
The generated search-index.json contains:
{
"version": "1.0.0",
"generator": "eleventy-plugin-search",
"generated": "2025-01-22T...",
"totalEntries": 10,
"config": {
"fuseOptions": { /* Fuse.js config for client reconstruction */ }
},
"stats": {
"totalEntries": 10,
"entriesByType": { "page": 10 },
"averageContentLength": 2048,
"totalContentLength": 20480
},
"entries": [
{
"id": "page:/about",
"type": "page",
"url": "/about",
"title": "About Us",
"content": "Full page text content...",
"excerpt": "First 250 characters...",
"headings": [
{ "level": "h2", "id": "our-mission", "title": "Our Mission" },
{ "level": "h2", "id": "our-team", "title": "Our Team" }
],
"wordCount": 523
}
]
}
import Fuse from 'fuse.js';
// Fetch the search index
const response = await fetch('/search-index.json');
const searchIndex = await response.json();
// Initialize Fuse.js with the index config
const fuse = new Fuse(searchIndex.entries, searchIndex.config.fuseOptions);
// Perform a search
const results = fuse.search('your search query');
// Results include score and matches
results.forEach((result) => {
console.log(result.item.title, result.score);
// Use headings for scroll-to functionality
result.item.headings.forEach((heading) => {
console.log(` ${heading.level}: ${heading.title} (#${heading.id})`);
});
});
The plugin generates clean URLs from file paths:
index.html → /about/index.html → /aboutblog/first-post.html → /blog/first-postFor headings without id attributes, the plugin generates URL-safe IDs:
hello-worldchapter-1-introductionsection, section-1, section-2Enable debug output to see what the plugin is doing:
DEBUG=Eleventy:search npx @11ty/eleventy
prefer-const, no-var, strict equality, and complexity limitsRun npm run prerelease before committing to ensure your code passes all checks.
This plugin is tested using mocha with c8 for code coverage. Current coverage: 97%.
MIT
Portions of this project were developed with the assistance of AI tools including Claude and Claude Code. These tools were used to:
All AI-assisted code has been reviewed and tested to ensure it meets project standards. See the included CLAUDE.md file for more details.
FAQs
HTML-first Eleventy search plugin with Fuse.js and Cheerio
The npm package eleventy-plugin-search receives a total of 4 weekly downloads. As such, eleventy-plugin-search popularity was classified as not popular.
We found that eleventy-plugin-search demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.

Security News
GPT-6 Astra hits 100% on ExploitBench and finds zero-days autonomously, while independent tests reveal scope violations and monitoring gaps.

Product
Socket can now send alerts and supply chain attack notifications to Microsoft Teams, with filters that route the right updates to each channel.

Security News
pnpm 12 rewrites the package manager in Rust, cutting install times by up to 90% while preserving pnpm 11 workflows and lockfiles.