Lunr Search
plugin
Source
Add instant full-text search to your site using Lunr.
Install
$ roq add plugin:lunr
Usage
Enable search for your site without the need for external, server-side, search services.
Setup
- Add the search index JSON:
<!-- content/search-index.json -->
{#include fm/search-index.json}
- 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 /}
{/}
- 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
---