This chapter covers:
- Evaluating JavaScript’s role in a Jamstack based website
- Building dynamic features like asynchronous form submission in our website
- Using npm modules assembled via Hugo’s support for the JavaScript/Typescript ecosystem to perform fuzzy search
- Embedding a single page application in a Hugo website
- Tip and technique to being successful with using JavaScript in a Hugo based website
The definition of dynamic in terms of websites has changed over time. In the early days of web, a dynamic website was the one that could have user generated content, server-side processing and all the great features we developed in the previous chapter (like comments and contact forms). This started to change with the advent of web applications which redefined dynamic as web pages that could update on the fly without explicitly reloading the whole content. These pages can not only fetch content in the background but also provide real-time updates without the user manually triggering some action. This modern definition of a dynamic website is possible with client-side processing which is done by a script that accompanies the website content and runs on the end user machine. JavaScript is the standard programming language that is used on the browser frontend and all frameworks including Hugo need to play nice with JavaScript to unlock additional features.