I updated Hugo recently and had to make some updates to keep things working. I haven’t been following extremely closely on Hugo development, so this may not all be the absolute best way to do things, but it did work for me.

I noticed that Hugo no longer liked me using straight HTML in my MarkDown files. I opted to go with creating a shortcode to provide the HTML needed on my search page.

So my previous search.md became:

---
title: "Search"
date: 1999-01-01
layout: page
exclude_search: true
---
{{< searchpage >}}
view raw search.md hosted with ❤ by GitHub

Then I created a shortcode in themes/<mytheme>/layouts/shortcodes/searchpage.html with:

<script src="https://unpkg.com/lunr@2.3.8/lunr.js"></script>
<script src="/search.js"></script>
<div>
<input id="search-input" type="text" placeholder="What are you looking for?" name="search-input" class="form-control">
</div>
<div id="search-results" class="container"></div>
view raw searchpage.html hosted with ❤ by GitHub

I also happened to update lunr to 2.3.8, which may or may not matter. Nothing in my search.js had to change though.