JSON Keys protocol support
If you use ExplorableSiteTree
to wrap a site that supports the JSON Keys protocol, the ExplorableSiteTree
instance will be able to programmatically return the keys at a given route. See that protocol for more details.
For example, you can use the ori CLI to display the keys of a given site route using the custom explore:
protocol, which returns an ExplorableSiteTree
.
$ ori keys explore://weborigami.org/samples/greetings/
- Alice
- Bob
- Carol
You can also use ori to display the complete contents of all pages at a given route:
$ ori explore://weborigami.org/samples/greetings/
Alice: Hello, Alice.
Bob: Hello, Bob.
Carol: Hello, Carol.
Above, the custom explore:
protocol retrieves the route’s keys defined in the .keys.json
, then makes separate requests for each of those pages.
ExplorableSiteTree class
A SiteTree that implements the JSON Keys
protocol. This enables a keys()
method that can return the keys of a site
route even though such a mechanism is not built into the HTTP protocol.
ExplorableSiteTree() constructor
async keys()
Returns: Promise
Returns the keys of the site route. For this to work, the route must have a
.keys.json
file that contains a JSON array of string keys.