feat: support Route Resolver uid
, lang
, and brokenRoute
options
#258
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Types of changes
Description
This PR adds support for Route Resolver's recently added
uid
,lang
, andbrokenRoute
options. Route Resolver definitions can be provided to@prismicio/client
'sroutes
option.Closes #257.
uid
optionThe
uid
option allows a route to be scoped to a document with a specific UID.In the following example, a Page document with a UID of
home
will result in a/
path. All other Page documents will use a computed path of/:uid
.lang
optionThe
lang
option allows a route to be scoped to a specific language.In the following example, a Page document with a language of
fr-fr
will result in a/fr/:uid
path. All other Page documents will use a computed path of/:uid
.brokenRoute
optionThe
brokenRoute
option allows a route to be defined for Link or Content Relationship fields where its linked document has since been unpublished or deleted.The
brokenRoute
option is provided adjacent to theroutes
option.In the following example, a Link field linked to a document that has been unpublished will have a
url
property of/404
. Link fields whose documents have not been deleted will follow the other given route definitions.Checklist:
🚓