In my various posts about developing static websites, I’ve pointed out that some critical functions can be tricky to implement. One example is pagination—splitting a long list of posts across several numbered pages. This is a nerdy deep-dive into how pagination works for two popular static site frameworks: Gatsby and Hugo.
About a month ago, I wrote about developing a static website with server-side Javascript. As I discovered, there are a lot of advantages to a static site. But one of the disadvantages to the lack of a database is that it isn’t obvious how to make the site searchable. With no database to pull from, generating search results can be a challenge.
Rather than pull search results from a database and generating results pages with server-side scripts, static sides tend to opt for storing results in a single file or external database and relying on AJAX to submit queries of the search index.
I’ve experimented with server-side JavaScript in the past, but I finally had an opportunity to dig in and actually build a website with it. I have a lot of experience with JavaScript in general; one of my major professional projects over the past few years was developing a complex web application entirely in JavaScript. For a number of reasons, I had to work only with vanilla JavaScript (no frameworks or libraries like jQuery).