Summary
In this chapter, we tackled adding request-time data to a static website without the need for any frontend JavaScript. By using 11ty Serverless, we were able to use all of our hard-earned 11ty knowledge to build out HTML pages on the fly at request time. There was no need for annoying JavaScript templating or a deep understanding of the Node.js runtime.
We used the 11ty RSS plugin with a special permalink and two new custom 11ty filters to create a JSON file appropriate for sending to the search solution Algolia. We sent that off to Algolia via its API and used 11ty’s events functionality to resend it every time 11ty builds the site.
We then added a serverless route to our static site so that users could submit a search form and get dynamic content back. This route was built with 11ty’s standard templating and the bundled 11ty Serverless plugin. We then took the user input from the search field and sent a query to Algolia to get back properly formatted and...