roboticmind avatar

Site Search Added to Gridcoin.us

roboticmind

Published: 29 Jun 2021 โ€บ Updated: 29 Jun 2021Site Search Added to Gridcoin.us

Site Search Added to Gridcoin.us

image.png
Screenshot of the new page with searching "superblocks"

What's New

There's now a search page added to gridcoin.us. You can get to it by clicking the ๐Ÿ” icon (if on mobile you will have to click the โ˜ฐ button first). This is especially useful for wiki pages, but it will work for the entire site.

โ€‹

How Does it Work?

Since gridcoin.us uses a static website generator (has no server side code), searching is more tricky to do. How it works is that a big list is sent your browser with all the page titles and content and it has your browser searches it itself. Your browser also figures out what part of the match is relevant enough to show as a snippet (this part took a lot of tweaking to get decent output)

This also means that users that disable JavaScript are unfortunately are out of luck (sorry). If you are one of these users, you can try using a search engine and putting site:gridcoin.us in your search instead.

โ€‹

What Did I Learn Making This

Searching is hard and figuring out which parts to show is also very hard. There's a lot of ways you can accidentally cut things off, make things too long, cause searching to go significantly slower, and much more.

There's usually more edge cases than you think, and this is was no exception. For a small example, when I added the ellipses (...) to the start and end to show text being cutoff, I forgot about how it might show a match from the very start or got to the end of the page. This made the little snippet confusing since nothing was actually cutoff. Fixing things like that and tweaking the output made this take way more time than I thought it would take.

โ€‹

More Information

For more information about all the change, see the pull request that added it to the site https://github.com/gridcoin-community/Gridcoin-Site/pull/302

Leave Site Search Added to Gridcoin.us to:

Written by

Read more #gridcoin posts


Best Posts From roboticmind

We have not curated any of roboticmind's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From roboticmind