My Hugo blog's search isn't working. Not sure what needs to be done

33 views Asked by At

I'm using Hugo paperMod theme. I read online to open the console. When I do that upon sharing I see the following error.

enter image description here

That implies that an index.json is missing somewhere. I don't know how to find it or point to it.

Also saw this question without an answer.

In my config file I don't see anything related to search. Nor anything in the config file of papermod's example site.

1

There are 1 answers

0
mfaani On

I was on the right path.

Hugo can typically generate your content in a variations of forms. See docs: Custom Output formats | Hugo

If you specify json as well, then it will create it for you.

See my updated config.yml file. I was missing JSON from my outputs. Adding that, fixed my search functionality.

# needed to ensure different manifestations of the site work. 
outputs:
  home:
  # To create webpages. 
    - HTML
  # To create RSS Feed
    - RSS
  # To create an index.json so search works on the site
    - JSON

After doing such my search worked. I was also able to find index.json at https://mfaani.com/index.json

Note: for your theme things could be different, but you get the idea.