.keys.json files
To participate in the async tree ecosystem, a server can indicate which keys are available at a given route by defining a .keys.json file. This is an array of the keys available at that route in JSON format.
For example, this site has a route /samples/greetings containing some trivial files. The server defines a JSON file at /samples/greetings/.keys.json that enumerates the names of those files:
["Alice", "Bob", "Carol"]
The strings for keys for subtrees will have a trailing /
after them.
If you ask a SiteTree
to enumerate the keys available at its URL, it will retrieve this .keys.json
file, then use those keys as the keys of the SiteTree
.
For example, you can use the ori CLI to display the complete contents of all pages at a given route using the custom tree or treehttp protocols.
$ ori tree://weborigami.org/samples/greetings/
Alice: Hello, Alice.
Bob: Hello, Bob.
Carol: Hello, Carol.
Above, the custom tree:
protocol retrieves the route’s keys defined in the .keys.json
, then makes separate requests for each of those pages.
The .keys.json
file should normally not include itself in its list of keys.
SiteTree class
SiteTree([href]) constructor
- href: string
resolve(path)
- path: string
Returns: SiteTree
Returns a new SiteTree
for the given relative route.