contentlayerdev / contentlayerdev/contentlayer

Attaching references after the build

Open
#420 0 comments 0 reactions 0 assignees View on GitHub
meta: never-stale needs-research topic: schema
Dominant language
TypeScript
Stars
3.5k
Forks
192
PR merge metrics
No merged PRs in 30d

Description

The simple version of this is that I have two document types and I want to cache some static field on a document _after_ the build has completed.

For example, let's say I have tags and posts, and I want a tag object to have a `postCount` attribute that caches the number of posts to which the tag was applied.

---

The more complex example is to be able to "hydrate" references without needing to write my own transformer function.

In the example above, posts would have a `tags` field reference. But I'd love if what were returned was of type `Tag[]` rather than `string[]`.

---

Having both together would be ideal.

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.