fix: 在搜索标题中显示中文内容

This commit is contained in:
Zhicheng WANG 2021-02-05 09:08:48 +08:00
parent 73bb7b552f
commit 3977fb897d
2 changed files with 2 additions and 1 deletions

View File

@ -23,6 +23,7 @@ module.exports = function h1CheckerPostProcessor() {
if (file.headings.h1.length > 2) {
file.fail(`More than two h1 found in ${file}`);
} else if (file.headings.h1.length > 1) {
file.titleCn = file.headings.h1[0];
file.title = file.headings.h1[1];
} else if (file.headings.h1.length === 1) {
file.title = file.headings.h1[0];

View File

@ -84,7 +84,7 @@ module.exports = function generateKeywordsProcessor(log, readFilesProcessor) {
}
// Extract the title to use in searches
doc.searchTitle = doc.searchTitle || doc.title || doc.vFile && doc.vFile.title || doc.name || '';
doc.searchTitle = doc.searchTitle || doc.title || doc.vFile && (doc.vFile.titleCn || doc.vFile.title) || doc.name || '';
// Attach all this search data to the document
doc.searchTerms = {