Skip to content
This repository was archived by the owner on Sep 25, 2025. It is now read-only.

Commit a3d54ea

Browse files
Merge pull request #61 from datacoves/DCV_2948-Fix-Search-on-Devdocs-site
generate search-index.js
2 parents 5a01dad + 6ea63f9 commit a3d54ea

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

indexer.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,20 @@ const documents = [];
3232

3333
;(async () => {
3434
for await (const filename of getHtmlFiles(input_path)) {
35-
const content = (await readFile(filename)).toString();
36-
37-
// We just want a chunk of this content
35+
const content = (await readFile(filename)).toString();
3836
const slice_content = content.split('<article class="markdown-section" id="main">');
37+
if (slice_content.length < 2) {
38+
continue;
39+
}
3940
const slice_again = slice_content[1].split('</article>');
40-
const body = slice_again[0].replace(/<[^>]*>?/gm, '').trim()
41-
41+
const body = slice_again[0].replace(/<[^>]*>?/gm, '').trim();
42+
4243
let url = "/" + relative(input_path, filename);
43-
44-
// Figure out the URL
44+
4545
if (url.endsWith('index.html')) {
4646
url = url.substr(0, url.length - 10);
4747
}
48-
48+
4949
documents.push({
5050
id: relative(input_path, filename),
5151
text: body,

0 commit comments

Comments
 (0)