Solve search feature not working problem when using Cactus theme in Hexo

After a long time of absence, I finally managed to set up this little blog here as my main technical archive.

First thing, this blog is using an awesome theme named Cactus (Dark) developed by Pieter Robberechts (@probberechts). The following is about the search user interface exposed in this theme.

Basically, after I put the blog online, I noticed that the search page just does not work. No matter what I typed in search box, nothing happened.

So, I performed the following steps:

  1. Of course, to make search feature work in Hexo, an additional package called hexo-generate-search must be installed and configured properly at first. The search user interface in Cactus theme relies on the search.xml file this package generates

  2. Follow the steps mentioned in Cactus repository:
    a. In Hexo, create a new page named Search
    b. Insert search: true in the front-matter of this page
    c. In _config.yml, Add search: /Search/ in nav section

  3. Regenerate static files in Hexo

  4. If search feature still does not work after all above steps, check if hexo-uglify plugin is being used. If did, remove it

Yep, the last one is what I encountered. For some reason, once I applied this plugin, the JavaScript code for search interface just stopped working (I guess it “uglifies” the code too hard to function). In my case, removing this plugin package made my blog back to normal.