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


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:

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