cmfcmf / docusaurus-search-local

Offline / Local Search for Docusaurus v2. Try it live at:
https://cmfcmf.github.io/OpenWeatherMap-PHP-API/
MIT License
437 stars 67 forks source link

Can't search document by title from docusaurus front matter #157

Closed svmakarov closed 1 year ago

svmakarov commented 1 year ago

Please describe the bug you are seeing

For example, I have page with following front matter:

---
id: wiki-tags
title: Wiki Tags
tags: [Owner - Proc, All]
sidebar_position: 3
pagination_next: null
pagination_prev: null
---

I can't find my doc by string "Wiki Tags", I can find doc only by page content.

How can we best reproduce the bug?

Which version of Docusaurus and @cmfcmf/docusaurus-search-local are you using?

0.11.0

Which Node.js version are you using?

v16.15.1

Which theme are you using?

Yes, I am using @docusaurus/theme-classic

How does your plugin config look like?

  require.resolve("@cmfcmf/docusaurus-search-local"),
  {
    language: ["en","ru"],
    indexBlog: false,
    indexPages: false,
  }

Additional context

No response

r3dcrosse commented 1 year ago

@svmakarov some ideas for a potential workaround/hack for now:

Workaround 1: Add the title to your page

---
id: wiki-tags
title: Wiki Tags
tags: [Owner - Proc, All]
sidebar_position: 3
pagination_next: null
pagination_prev: null
---

# Wiki Tags

Workaround 2: Add a hidden title that gets indexed by docusaurus-search-local

---
id: wiki-tags
title: Wiki Tags
tags: [Owner - Proc, All]
sidebar_position: 3
pagination_next: null
pagination_prev: null
---

<h1 style={{ display: "none" }} aria-hidden="true">Wiki Tags</h1>
cmfcmf commented 1 year ago

Duplicate of https://github.com/cmfcmf/docusaurus-search-local/issues/146, will be fixed in the next version.