Skip to content

Commit 9b4b84e

Browse files
committed
Filter out pages with no content. Related to canjs/can-component#102
1 parent fb018ba commit 9b4b84e

File tree

2 files changed

+35
-12
lines changed

2 files changed

+35
-12
lines changed

generators/search-map.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,19 @@ module.exports = function(docMap, siteConfig) {
2525
for (name in docMap) {
2626
if (docMap.hasOwnProperty(name)) {
2727
var docObj = docMap[name];
28-
29-
var description = helpers.stripMarkdown(docObj.description);
30-
description = unescapeHTML(description);
28+
// If there is no body, it's likely we don't want to index it
29+
if(docObj.description || docObj.signatures || docObj.params || docObj.return || docObj.options){
30+
var description = helpers.stripMarkdown(docObj.description);
31+
description = unescapeHTML(description);
3132

32-
var searchObj = {
33-
name: docObj.name,
34-
title: docObj.title,
35-
description: description,
36-
url: filename(docObj, siteConfig)
37-
};
38-
searchMap[name] = searchObj;
33+
var searchObj = {
34+
name: docObj.name,
35+
title: docObj.title || docObj.name,
36+
description: description,
37+
url: filename(docObj, siteConfig)
38+
};
39+
searchMap[name] = searchObj;
40+
}
3941
}
4042
}
4143

@@ -47,4 +49,4 @@ module.exports = function(docMap, siteConfig) {
4749
});
4850
});
4951

50-
};
52+
};

test.js

Lines changed: 22 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)