#data-pagefind-ignore

3 messages · Page 1 of 1 (latest)

formal bluff
#

I'm using data-pagefind-ignore with the astro-pagefind package, but the content I want to ignore keeps showing up. How can I prevent this from happening? I also want to know if I can prevent astro-pagefind from indexing a whole page?

true sundialBOT
#

Hi @formal bluff. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

To exclude a part of a page from the search index, you can use the data-pagefind-ignore attribute. This attribute should be added to the HTML element that contains the content you want to ignore. Pagefind will then ignore the content inside this element. Here's an example:

<div data-pagefind-ignore>
This text will be hidden from search.
</div>

If the content you want to ignore keeps showing up, make sure that the data-pagefind-ignore attribute is correctly added to the right element and that there are no typos or syntax errors.

To exclude an entire page from the search index, you can add pagefind: false to the page’s frontmatter. Here's an example:

---
title: Content to hide from search
pagefind: false
---

This will prevent the page from being included in the Pagefind search index.

For more information, you can refer to the Astro guides on site search (https://starlight.astro.build/guides/site-search/#_top) and the Astro reference on frontmatter (https://starlight.astro.build/reference/frontmatter/#pagefind).

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: