Install

Terminal
$ roq add plugin:lunr

Usage

Enable search for your site without the need for external, server-side, search services.

Setup

  1. Add the search index JSON:
<!-- content/search-index.json -->
{#include fm/search-index.json}
  1. Inject the search script in the <head> of your layout. For example with the default theme:
<!-- templates/layouts/default.html -->
---
theme-layout: default
---

{#insert /}

{#head}
{#search-script /}
{/}
  1. Inject the search overlay in the <body> and search button in the navigation:
<!-- templates/layouts/main.html -->
---
theme-layout: main
---

{#search-overlay /}
{#insert /}

{#menu}
{#search-button /}
{#include partials/roq-default/sidebar-menu menu=cdi:menu.items /}
{/}

Controlling indexing

You can prevent content from being indexed:

---
title: I don't want to be indexed
search: false
---

You can also boost specific pages or layouts in the results:

---
title: I want to be first in the result
search-boost: 30
---