Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow searching of metadata #532

Open
skrysmanski opened this issue Dec 22, 2023 · 2 comments
Open

Allow searching of metadata #532

skrysmanski opened this issue Dec 22, 2023 · 2 comments
Labels
improvement Not a bug Pagefind CLI The CLI responsible for indexing content Pagefind Search The web-facing search js/wasm API

Comments

@skrysmanski
Copy link

I've noticed that Pagefind doesn't seem to find pages where the search terms just appear in the title - if it's outside data-pagefind-body.

Basically I have pages like this:

<header>
  <h1 data-pagefind-meta="title">PHP Cheat Sheet</h1>
</header>
<article data-pagefind-body>
  ...
</article>

In my example, the words "cheat sheet" don't appear in the actual article but just in the title.

If I now search for "cheat sheet" (with the Default UI), Pagefind doesn't find this page.

My workaround is to also add data-pagefind-body to the <h1> element but in my opinion this shouldn't be necessary.

This problem probably extends to all meta data.

@bglw
Copy link
Contributor

bglw commented Jan 6, 2024

Correct on all counts (that this is currently intended, but isn't desirable). I'm hoping that part of #437 will involve bringing more metadata into the search index, but it needs a little bit of care to support use-cases where other metadata explicitly shouldn't be searchable.

Since this issue captures it more generally, I'll keep both around and track the overall ability to search metadata here 🙂

@bglw bglw added improvement Not a bug Pagefind Search The web-facing search js/wasm API Pagefind CLI The CLI responsible for indexing content labels Jan 6, 2024
@bglw bglw changed the title Title (meta data) is not included in search Allow searching of metadata Jan 6, 2024
@bglw
Copy link
Contributor

bglw commented Jan 6, 2024

(Possibly helpful context for why this isn't a simple toggle: Currently the metadata only exists in the final page fragment that is loaded when showing a result. The metadata doesn't exist at the time of querying, so the index itself will need to change to implement this feature)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Not a bug Pagefind CLI The CLI responsible for indexing content Pagefind Search The web-facing search js/wasm API
Projects
None yet
Development

No branches or pull requests

2 participants