Deliveries
You can configure deliveries to let Livingdocs know something about the delivery/deliveries you operate.
As of December 2020 this is used to enable the Internal Document Links feature.
An example:
1
// deliveries is configured at projectConfig.deliveries
2
deliveries: [
3
{
4
handle: 'web',
5
label: 'Website',
6
isPrimary: true,
7
icon: 'book-open',
8
url: {
9
origin: 'https://example.com',
10
pathPattern: '/article/:id'
11
}
12
},
13
{
14
handle: 'app',
15
label: 'App',
16
icon: 'rocket',
17
url: {
18
origin: 'https://example.com',
19
pathPattern: '/app/article/:id'
20
}
21
}
22
]
Copied!

pathPattern

The Internal Document Links feature will construct a URL to a document based on these placeholders:
  • :id (document.id, always available)
  • :projectId, (document.projectId, always available)
  • :slug (document.metadata.slug, available if you have a metadata property with the handle slug)
This URL is then inserted into to a tags href attribute within the document. Additionally a data-li-document-ref attribute is written containing the document.id.

Caveats

Since the Internal Document Links is specifically handy to link to not yet published documents you want to validate these links somewhere in your delivery to remove the ones pointing to not yet published documents. As this feature works on unpublished documents, Livingdocs cannot resolve the routing information since this stores the information on publish which makes it unavailable before a document is published.
To have the Internal Document Links feature be able to construct working href attributes, you need a routing system in your delivery that is able to redirect a user do a valid document URL based on the document.id and document.projectId only.
Last modified 9mo ago
Copy link