ThoughtsInWords

Adding Search to a Markdown-Backed GitHub Pages Site: Open Source & Free Libraries

Date: July 29, 2026

GitHub Pages is one of the most popular and frictionless ways to host a static site, especially when driven entirely by a repository of Markdown files. By default, GitHub Pages uses Jekyll behind the scenes to convert your Markdown into HTML.

While this setup is incredibly convenient for documentation, blogs, and digital gardens, it presents a unique challenge for search. Because you are serving static files, you lack a database. Furthermore, if you rely on the default GitHub Pages build process (rather than GitHub Actions), you are restricted from running custom Node.js or Rust post-build scripts to generate a search index.

Fortunately, there are excellent open-source, free strategies to implement search on a Markdown-backed GitHub Pages site.

Approach 1: Pure Liquid Templates (No Custom Build Steps)

If you are using the standard GitHub Pages Jekyll integration and don’t want to configure GitHub Actions, your best approach is generating an index file using Jekyll’s templating engine (Liquid) and consuming it with a client-side JavaScript library.

1. Lunr.js

Lunr.js is a powerful client-side search engine. You can create a search.json file in your repository that uses a Liquid loop to output all your Markdown posts into a JSON array:

---
layout: null
---
[
  
]

On your frontend, you fetch this search.json, load it into Lunr.js, and provide a full-text search experience natively in the browser.

This is a lightweight wrapper specifically designed for this architecture. It consumes a similarly generated search.json file but is arguably easier to set up than raw Lunr.js for simple fuzzy matching.

Approach 2: Using GitHub Actions

In recent years, GitHub has made it incredibly easy to use GitHub Actions to build and deploy to GitHub Pages, bypassing the default Jekyll builder. This is a game-changer because it allows you to run modern, compiled search indexers during your build process.

If you switch your deployment to GitHub Actions, Pagefind becomes the definitive best choice. Written in Rust, it runs as a post-build command. It indexes the generated HTML folder and creates highly optimized, chunked WebAssembly (WASM) indexes.

4. Orama / Fuse.js

With GitHub Actions, you can also run Node scripts to parse your Markdown files directly (e.g., using gray-matter) and generate highly compressed, pre-computed indexes for modern engines like Orama (for edge-optimized, typo-tolerant search) or Fuse.js (for lightweight fuzzy matching).

Summary: Which should you choose?

  1. If you want the absolute best performance and user experience: Switch your GitHub Pages setting to use “GitHub Actions” and use Pagefind. It is the gold standard for static site search today.
  2. If you want to keep things simple and avoid GitHub Actions: Use Liquid templates to generate a JSON endpoint and index it on the client side using Lunr.js.

By leveraging these open-source tools, your Markdown-backed GitHub Pages site can provide a premium, instantaneous search experience without relying on expensive third-party SaaS providers.