diff --git a/src/indexer/index.ts b/src/indexer/index.ts index e60ce77..8652f63 100644 --- a/src/indexer/index.ts +++ b/src/indexer/index.ts @@ -39,16 +39,12 @@ export class Indexer { * * @returns {void} */ - add( - lang: string, - url: string, - data: Pick, - ) { + add(lang: string, url: string, data: Pick) { if (!this.indices[lang]) { this.init(lang); } - const {leading, toc, meta = {}} = data; + const {leading, title = '', meta = {}} = data; // @ts-ignore if (leading || meta.noindex || meta.noIndex) { @@ -56,7 +52,6 @@ export class Indexer { } const content = html2text(data.html); - const title = meta.title || data.title || toc.title || ''; const keywords = meta.keywords || []; this.docs[lang][url] = {title, content, keywords}; diff --git a/test/index.spec.ts b/test/index.spec.ts index fdeef77..357f477 100644 --- a/test/index.spec.ts +++ b/test/index.spec.ts @@ -46,7 +46,6 @@ describe('suggest', () => { title, leading: false, meta: {}, - toc: {items: [], href: ''}, }); }