The approach encouraged for putting all page content into a JSON file that can be used for user searching is to create a JSON output format for the home page. This does not work in general, since there can be other uses of JSON formats, such as the relatively new JSON feed format. Where search is an optional feature, there’s no way to know whether a “JSON” output format in .AlternateOutputFormats is something the user created for their own purposes like JSON feeds, or whether they enabled the search feature. So when listing alternate formats for a page, say in an RSS or Atom feed, there’s generally no way to know whether a JSON format should be omitted (because it’s a hack special case for the home page), or if it should be included (because it’s for a JSON feed).
notAlternative: true for the output format that is not a “alternative”. I use this on many sites where I generate a JSON search index and a JSON feed.
outputFormats: SearchIndex: mediaType: "application/json" baseName: "searchindex" isPlainText: true notAlternative: true
How do you cause the file to be generated? Do you put a
home.searchindex.json in the layouts/_default directory?