contentlayerdev / contentlayerdev/contentlayer

Attaching references after the build

Đang mở
#420 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
meta: never-stale needs-research topic: schema
Ngôn ngữ chính
TypeScript
Star
3.5k
Fork
192
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

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.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.