From 59079bc18d5bdeb89cb7b8574cb29c66d30dc123 Mon Sep 17 00:00:00 2001 From: Soreine Date: Tue, 18 Oct 2016 16:36:46 +0200 Subject: [PATCH] plugin-lunr: Fix reading page search attributes --- packages/gitbook-plugin-lunr/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/gitbook-plugin-lunr/index.js b/packages/gitbook-plugin-lunr/index.js index abc345f01..bdde8f66a 100644 --- a/packages/gitbook-plugin-lunr/index.js +++ b/packages/gitbook-plugin-lunr/index.js @@ -41,7 +41,9 @@ module.exports = { hooks: { // Index each page 'page': function(page) { - if (this.output.name != 'website' || !searchIndexEnabled || page.search === false) { + const search = page.attributes.search; + + if (this.output.name != 'website' || !searchIndexEnabled || search === false) { return page; } @@ -64,8 +66,8 @@ module.exports = { } var keywords = []; - if (page.search) { - keywords = page.search.keywords || []; + if (search) { + keywords = search.keywords || []; } // Add to index