contentlayerdev / contentlayerdev/contentlayer

Attaching references after the build

未关闭
#420 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
meta: never-stale needs-research topic: schema
主要语言
TypeScript
星标
3.5k
派生
192
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。