Apparently, you can provide a routers query parameter to the API and it will "resolve" urls for documents and links with this information on the server returning the urls in the payload.
This means that all types would possibly contain a top-level url property and url may also be present in links that have Document type.
The documentation is pretty scant:
… but it looks like you can provide router config during initialisation and then reuse the config for every request thereafter. I assume that the config will be included in the meta-data payload as default options for the forms property.
Currently, it looks like routers should be specified as a JSON array of objects, something like this:
let routers = [
{
"type": "my-type", // Name of document type
"path": "/products/:range/:category/:uid", // Where ":category" is the UID of the linked category document and ":range" is the UID of the grandparent category.range document
"resolvers": {
"category": "parent-category", // Top-level content relationship to a "category" type where "parent-category" is the property name of "my-type"
"range": "category.range" // "range" is a property of "category" in this example being a content-relationship to a range document.
}
},
{
"type": "blog-post",
"path": "/:lang/blog/:uid" // :lang is the document locale ie 'en-gb'
},
// Not yet known whether other types/properties are feasible such as
{
"type": "whatever",
"path": "/:id/:date-published/:tags" // <- Who knows?
}
];
Apparently, you can provide a
routersquery parameter to the API and it will "resolve" urls for documents and links with this information on the server returning the urls in the payload.This means that all types would possibly contain a top-level
urlproperty andurlmay also be present in links that have Document type.The documentation is pretty scant:
… but it looks like you can provide router config during initialisation and then reuse the config for every request thereafter. I assume that the config will be included in the meta-data payload as default options for the
formsproperty.Currently, it looks like routers should be specified as a JSON array of objects, something like this: