prismicio / prismic-helpers

Set of helpers to manage Prismic data
https://prismic.io/docs/technical-reference/prismicio-helpers
Apache License 2.0
15 stars 9 forks source link

Link resolver should be optional in `asLink`, `asHTML` #21

Closed angeloashmore closed 3 years ago

angeloashmore commented 3 years ago

A Link Resolver function is currently required in asLink and asHTML.

A Link Resolver should be optional instead since users may use Route Resolvers to populate a document or link's url field. In those cases, a Link Resolver would be unnecessary.

When a Link Resolver is not provided, it should fallback to field.url. This is what v1 does:

https://github.com/prismicio/prismic-helpers/blob/d52211645faad6a85d2d6874a8477254cbbc4da8/src/link.js#L4-L17

lihbr commented 3 years ago

Nice catch