Re-enabling search on my static website

When I migrated this website from Jekyll to Hugo, I decided to not migrate my search functionality. This was partly because it was too much work to think about at the time, but also as I wasn't really sure whether anyone was using it.

My workaround for this was the fact that the /posts/ page would always list all of my posts, so I'd be able to hit that page and use the browser's search to find it.

Well, that was all well and good until early March when I enabled pagination in my site, which meant that /posts/ would be limited to 10 posts per page, meaning my > 100 posts were now harder to search. Instead, I either needed to remember the taxonomy I'd used (which I'm generally pretty good with) or would have to trawl through the paginated posts.

This got until the other day where I decided enough was enough, and decided to properly solve it - which is what I'm announcing now, and was implemented at tonight's Homebrew Website Club in Nottingham.

I hooked this in by using my JSON Feed which I implemented at the beginning of April, and is a great format for searching on. This means I don't need to create a separate format just for the sake of search, too, which was a big plus point for me!

Give it a go on /search/ and let me know what you think!

Interestingly, as per the Indieweb levels for search I may qualify for Level 5, because it's all done client-side. Which is pretty lucky because this site is super static and I don't want to be relying on 3rd party services to host search.

Written by Jamie Tanna's profile image Jamie Tanna on , and last updated on .

Content for this article is shared under the terms of the Creative Commons Attribution Non Commercial Share Alike 4.0 International, and code is shared under the Apache License 2.0.

Tags
Syndication

This post will be syndicated to these sites:

Related Posts

Other posts you may be interested in:

Interactions with this post

Interactions with this post

Below you can find the interactions that this page has had using WebMention.

Have you written a response to this post? Let me know the URL:

Do you not have a website set up with WebMention capabilities? You can use Comment Parade.