From 5bd24ad3eabbb03b87a61e3cb9f73c27ce4ee321 Mon Sep 17 00:00:00 2001 From: Westly Wright Date: Tue, 10 Jul 2018 15:13:43 -0700 Subject: [PATCH] more debug --- scripts/build-algolia.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/build-algolia.js b/scripts/build-algolia.js index 5debce1487c..f98bc4fa10f 100755 --- a/scripts/build-algolia.js +++ b/scripts/build-algolia.js @@ -38,7 +38,7 @@ nodes.forEach(node => { let next = child.nextElementSibling; while(next && next.tagName !== 'H2') { - if (next) { + if (next && next.textContent) { paragraphOut.content += next.textContent; } next = next.nextElementSibling; @@ -73,7 +73,7 @@ nodes.forEach(node => { console.log('===================================='); } - nue.push(paragraphOut); + nue.push(node); } @@ -85,7 +85,6 @@ nodes.forEach(node => { }); -const merged = [...nodes, ...nue]; -fs.writeFileSync('public/final.algolia.json', JSON.stringify(merged)); +fs.writeFileSync('public/final.algoia.json', JSON.stringify(nue)); process.exit(0);