Origami.

jsonKeys(tree)

This function implements the JSON Keys protocol for a tree-like structure. It generates a .keys.json file for each route in the tree, listing the keys available at that route.

Suppose a site has the following structure:

// site.ori
{
  about: {
    index.html: "About Us"
  }
  index.html: "Home page"
}

You can wrap the site definition with a call tojsonKeys:

// site.ori
Origami.jsonKeys({
  about: {
    index.html: "About Us"
  }
  index.html: "Home page"
})

to add the .keys.json files at all levels:

$ ori site.ori/.keys.json
["about/","index.html"]
$ ori site.ori/about/.keys.json
["index.html"]

Alternatively, you could change the site’s build script in package.json to invoke Origami.jsonKeys:

"build": "ori 'copy Origami.jsonKeys(src/site.ori), clear files:build'"

By including the .keys.json files in the static build of the site, you will make it possible for yourself and others to completely traverse the site tree using the SiteMap class and the explore: protocol.

See also static.