<PrismicLink>
requires specific properties in the provided field or document to render properly. This requirement extends to Link, Link to Media, and Content Relationship fields.
If the required properties are missing, <PrismicLink>
will not render the link.
Note: When using Prismic's Rest API (the default when using @prismicio/client
), the required fields are automatically included. When using Prismic's GraphQL API, you must include these fields in your query.
The following properties are requried when using the field
prop with a Link, Link to Media, or Content Relationship field:
link_type
(or_linkType
when using Prismic's GraphQL API)id
url
uid
(only if your website uses a Link Resolver that uses a document's UID field)
The following properties are not required, but are recommended:
target
Example:
<PrismicLink field={doc.data.linkField}>Click me</PrismicLink>
The following properties are requried when using the document
prop with a Prismic document:
id
url
uid
(only if your website uses a Link Resolver that uses a document's UID field)
Example:
<PrismicLink document={doc}>Click me</PrismicLink>
When using Prismic's GraphQL API, Link fields must be queried with at least the following properties:
{
page(uid: "home", lang: "en-us") {
linkField {
+ _linkType
+ id
+ url
+ uid # only required if your website uses a Link Resolver that uses a document's UID field.
+ target # not required, but recommended for automatic `target` handling
}
}
}