Implementing Pagefind Search in Header with Distinctive Results Display #491
Unanswered
eyallampel1
asked this question in
Q&A
Replies: 1 comment 3 replies
-
Hey @eyallampel1 👋 Possibly Pagefind's Modular UI might be a good fit. It's still in a bit of a state of flux, so I'd pin an exact version, but it more closely supports using a search input in one area, and placing the results somewhere else. It runs the search on https://cloudcannon.com/documentation/ — so it's stable enough for production, just the API might change in a future release 🙂 |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello All,
I'm currently integrating the Pagefind search library into my website's header component and encountering a few challenges I hope to get some assistance with.
Issue Description:
When search results are generated, they expand the header component, disrupting the layout. My goal is to achieve a search experience similar to Algolia's, where activating the search dims the main content and presents the results in a distinct overlay.
Attempts and Challenges:
I've tried setting the search element to a higher z-index and using absolute positioning. This approach partially works, but I'm unable to change the background color of the search results to make them visible against the body's background.
I've experimented with JavaScript to detect clicks within the search element and dim the rest of the site. However, this hasn't been successful due to compatibility issues with the Astro framework, which doesn't favor heavy JS solutions.
Questions:
Any guidance, examples, or pointers to documentation would be greatly appreciated. I'm looking for a solution that maintains the static nature of Pagefind while providing a seamless and intuitive search experience.
Thank you for your time and assistance!
Beta Was this translation helpful? Give feedback.
All reactions