--- --- // data var pages = [ {% for post in site.posts %} { "id": "{{ post.url | slufigy }}", "title": {{ post.title | jsonify }}, "content": {{ post.content | strip_html | jsonify }}, "url": "{{ post.url | xml_escape }}" } {% unless forloop.last %},{% endunless %} {% endfor %} ]; // index var idx = lunr(function () { this.ref('url'); this.field('title'); this.field('content'); pages.forEach(function (doc) { this.add(doc); }, this); }); function do_search(queryterm) { return idx.search(queryterm); }