Make zola ability to export search index into json instead of js

Hello,

I currently working on the implementation of a search feature for my personal site and discovered the search index feature coming from Zola.

However, it only exports this index into a js file.

I would make the ability to export it into a JSON file that can be loaded with an XHR request; useful when this search index is heavy.

I made a draft implementation in my fork: https://github.com/citorva/zola/commit/57757c0f745174a77f60c66ab90a64e76fb7e140

Why not load the current index with defer on the script node? I don’t see how the XHR helps there?

It is because I would only load the search index when the user would use the search feature