summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-plugin-lunr/index.js
diff options
context:
space:
mode:
authorSoreine <nicolas@gitbook.com>2016-10-18 16:36:46 +0200
committerSoreine <nicolas@gitbook.com>2016-10-18 16:40:49 +0200
commit59079bc18d5bdeb89cb7b8574cb29c66d30dc123 (patch)
tree57f1efeac06f5ee946feb3d8bef01d7277e97e04 /packages/gitbook-plugin-lunr/index.js
parent66c2a6c0764f106e312bcc8c04ba00c9e5044ea1 (diff)
downloadgitbook-59079bc18d5bdeb89cb7b8574cb29c66d30dc123.zip
gitbook-59079bc18d5bdeb89cb7b8574cb29c66d30dc123.tar.gz
gitbook-59079bc18d5bdeb89cb7b8574cb29c66d30dc123.tar.bz2
plugin-lunr: Fix reading page search attributes
Diffstat (limited to 'packages/gitbook-plugin-lunr/index.js')
-rw-r--r--packages/gitbook-plugin-lunr/index.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/packages/gitbook-plugin-lunr/index.js b/packages/gitbook-plugin-lunr/index.js
index abc345f..bdde8f6 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