contentlayerdev / contentlayerdev/contentlayer

allow to configure how `reference` field values resolves to file paths

Open
#235 0 comments 1 reaction 0 assignees View on GitHub
feature needs-research pkg/source-files
Dominant language
TypeScript
Stars
3.5k
Forks
192
PR merge metrics
No merged PRs in 30d

Description

currently, [`reference` fields](https://www.contentlayer.dev/docs/reference/source-files/field-types#reference) expect a path to another document file, relative to `contentDirPath`. it would be great if we could configure how a reference field value resolves to the relative file path.

in my case, i am using "Netlify CMS", which also has a similar concept of [`relation` fields](https://www.netlifycms.org/docs/widgets/#relation) (and saves to markdown/yaml). however, it will only save the `slug` as field value, and use the `folder` and `extension` of a `collection` to construct file paths. e.g. it will save `"my-tag"` as relation field value, to reference a document in `"tags/my-tag.yml"` (when the `tags` collection has `folder: "tags", extension: "yml"` configured)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.