Using Hugo to Build a Job Board / Jobs Portal - How To Implement Search?

Hi,

I am thinking of building a Job Board I am working on, using Hugo. Since the content won’t change much day to day, I think Hugo is a great choice.

The thing holding me back is the home page search feature that is ubiquitous in every job board / job portal.

How do I go about implementing such a search feature if I use Hugo?

For instance, see this HTML theme => Job Portal HTML Template

How would I go about implementing the search feature if I use Hugo and customize this theme?

NOTE: I have developed an API and a database to store the actual job listings with title, tags, final urls, etc. The idea is that I will generate the individual Hugo Posts (of job type) and publish the site as and when new jobs are submitted to the site (form submission).
This means, I can, if needed to implement this, generate a JSON data file containing Job Titles, Locations, and URLs of Single Job Post for the search feature to “Search in” if that’s that way to do it.

Let me know!! Thanks!!!

Search this forum for “lunr.js” and there are some examples, @Shiva.

Assuming your site is going to be quite large, you’re going to run into limitations (file size) with the Lunr.js approach and may need to look at a server-based solution. A commercial solution that a lot of people like is Algolia.

2 Likes

@Shiva To Bud’s point about size:

https://github.com/olivernn/lunr.js/issues/222

However, if you’re especially clever with JS, you can user service workers…

I’m coming from Nikola which can use Tipue as one of the custom search options so wonder if anyone can share experiences of its usage with Hugo, iow. any pro/cons?

I looked at Tipue and it looks interesting and appears to be well documented… Seems like you can supply the data to search for in a .js data file.

Although I am not sure about performance over, say, 10,000 Job listing generated and stored in a .js file.

Thanks. I looked at Algolia, and pricing seems prohibitive once you cross the free tier. $49 / month for search feels like a lot.

Also, in my use case, I need to search the job listing on the 2 or 3 specific field matches, not the “entire site index”.

I guess I’ll stick to an ASP.Net client for now :frowning:

@Shiva in my experience, Lunr is faster than Tipue (and cuts down file size out of the gate because Lunr doesn’t have the jQuery dependency). Here is a decent article on Service Workers with Lunr that might provide some insight…

https://richardcooke.info/use-a-web-worker-to-asynchronously-populate-a-lunr-js-full-text-search-index/

Bleve is pretty powerful and should not be too hard to set up with Hugo (they have a blog post about it).

1 Like

Hey, @Shiva

Well while you’re getting started, you can easily do a client-side solution, then later, when you have a lot of content, a hosted or server-side solution will likely be necessary (service workers are, unfortunately, an unfriendly solution for a large site still, as you’re asking all your users to download a ton of content, even if they don’t use search). I’ve done client-side search using Lunr with several thousand records with a bit of prefetching and it works okay, but at some point you’re going to feel the difference. Hopefully, when it gets to that point, it makes business sense to pull in a more high powered solution.

I haven’t set up an Algolia-based search, but I imagine you can index only what you want (but @rdwatters might know). Their free tier will get you pretty far, if you don’t mind the branding, and it is incredibly simple to add to your site.

Lastly, here’s a video from my Meetup last year. This is a friend from 18F (a group in the U.S. Govt.) who has dealt with some of these issues, and talks about setting up a server-side solution as well as some of the other options: https://youtu.be/zahaMg3X0Tc

1 Like