Skip to content

Commit

Permalink
fix: Drop data toc usage
Browse files Browse the repository at this point in the history
  • Loading branch information
3y3 committed Oct 29, 2024
1 parent 13c0145 commit 3a6a4ba
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
9 changes: 2 additions & 7 deletions src/indexer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,19 @@ export class Indexer {
*
* @returns {void}
*/
add(
lang: string,
url: string,
data: Pick<DocPageData, 'title' | 'html' | 'meta' | 'leading' | 'toc'>,
) {
add(lang: string, url: string, data: Pick<DocPageData, 'title' | 'html' | 'meta' | 'leading'>) {
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) {
return;
}

const content = html2text(data.html);
const title = meta.title || data.title || toc.title || '';
const keywords = meta.keywords || [];

this.docs[lang][url] = {title, content, keywords};
Expand Down
1 change: 0 additions & 1 deletion test/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ describe('suggest', () => {
title,
leading: false,
meta: {},
toc: {items: [], href: ''},
});
}

Expand Down

0 comments on commit 3a6a4ba

Please sign in to comment.