Searching the Jamstack

Searching the Jamstack

At 3/31/2024

Here’s Raymon Camden on adding site search functionality to a site that is statically hosted. A classic trick! Just shoot ’em to Google and scope the results to your site:

<form action="https://www.google.com/search" method="get">
  <input type="search" name="q" value="site:https://www.raymondcamden.com " autofocus size="50">
  <input type="submit" value="Search">
</form>

I’d probably use JavaScript to inject that site: stuff before sending them over just so the search field doesn’t have that weird prefilled stuff in there, which might be off-putting. We covered that here.

Raymond then gets into Google Custom Search Engines, which is their product to provide scoped search on your own site. It’s desirable because it’s Google’s search for your own site. Whatever you might think of Google, they have great search results. That’s the thing. Even if you aren’t a Jamstack site and can freely use your own server to query content on your site, chances are your search results aren’t as good as Google’s.

Say you reach for another search solution… Solr, Lunr, ElasticSearch, Algolia. They are all kinda nice in their own way. The trick is making sure they have enough data for them to return good results, beyond just the content. You’ll never have an entire internet’s worth of backlinks to leverage, but ideally, you can factor in analytics data at the very least.

Direct Link →

Copyrights

We respect the property rights of others and are always careful not to infringe on their rights, so authors and publishing houses have the right to demand that an article or book download link be removed from the site. If you find an article or book of yours and do not agree to the posting of a download link, or you have a suggestion or complaint, write to us through the Contact Us, or by email at: support@freewsad.com.

More About us