Site Search Added to Gridcoin.us

in Gridcoin (GRC)3 years ago

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

Sort:  

Congratulations @roboticmind! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s) :

You received more than 300 upvotes.
Your next target is to reach 400 upvotes.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Check out the last post from @hivebuzz:

Feedback from the July 1st Hive Power Up Day - ATH Volume record!