
Implementing Search in Astro
I needed a search bar. I restrained myself so I didn't reinvent the wheel, so I used a package. How to add a search bar feature to your Astro site! The easy way.
I needed a search bar. I restrained myself so I didn't reinvent the wheel, so I used a package. How to add a search bar feature to your Astro site! The easy way.
I wanted to explore the Share API, so I built this neat little Astro component that triggers the share experience in the supporting browsers.
A couple of things have happended since my last post. I was even posting to a different blog altogether (also powered by Astro). But when building this site you are visiting, I had to revisit Astro docs and I wanted to implement a couple of features.
I wanted to include some sort of search feature. You sometimes remember reading something somewhere; you remember the creator, but you don’t have handy the link. What do you do? You search for the thing.
I ended up using pagefind
for my search bar. If you want to read how, you can read it here.
Sure, you can just copy the URL and paste it somewhere else, but having a dedicated share button makes it easier, and easier means happy users.
Well, there’s also a hidden gem in the browser APIs: the share API.
If you want to know how I implemented the button, you can read about it here.