From 3a6a4baf45bdaaf6ad1c8d3b0eed040d05cbcc51 Mon Sep 17 00:00:00 2001 From: 3y3 <3y3@ya.ru> Date: Tue, 29 Oct 2024 12:31:12 +0300 Subject: [PATCH] fix: Drop data toc usage --- src/indexer/index.ts | 9 ++------- test/index.spec.ts | 1 - 2 files changed, 2 insertions(+), 8 deletions(-) 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: ''}, }); }