Add headings in search result

This commit is contained in:
Sat Naing
2022-09-25 19:44:36 +06:30
parent 3f52daf865
commit d275f607a3
2 changed files with 7 additions and 5 deletions
+2 -1
View File
@@ -8,6 +8,7 @@ import type { Frontmatter } from "src/types";
type SearchItem = {
title: string;
description: string;
headings: string[];
frontmatter: Frontmatter;
};
@@ -31,7 +32,7 @@ export default function SearchBar({ searchList }: Props) {
};
const fuse = new Fuse(searchList, {
keys: ["title", "description"],
keys: ["title", "description", "headings"],
includeMatches: true,
minMatchCharLength: 2,
threshold: 0.5,