Replies: 1 comment
-
This would be very cool! 🔥🔥 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Update: this proposal has been moved to stage 2. Continue discussion here
Body
Summary
Content collections unlocks some huge benefits, especially the DX benefits of type-checked markdown frontmatter. Adding support for relational content, i.e. a
blog
collection that references anauthors
collection, would be a huge step to allow more flexible content modelingBackground & Motivation
Taking a blog post as the example, there will likely be author information thats reused across multiple blog posts. To standardize updates when I'm changing something like an author's avatar image, it'd be nice to have an
authors
orpeople
collection that each blog post can reference by slug.Astro's content APIs could use that for type-checking to make sure a known author slug is used and prefetch the data so
blog.data.author
would be the actual data rather than a string that needs to be passed back intogetEntryBySlug
Goals
Minimum goal - type-safe references by slug. i.e. The blog collection would validate that
blog.data.author
is a valid slug, but wouldn't transform or preload that data at allBonus points - related content is pre-fetched and the slug is replaced with the related data. i.e. once loaded,
blog.data.author
would be an object with the author's parsed content instead of the author's slugExample
Hacky userland experiment
Beta Was this translation helpful? Give feedback.
All reactions