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
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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
blogcollection that references anauthorscollection, 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
authorsorpeoplecollection 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.authorwould be the actual data rather than a string that needs to be passed back intogetEntryBySlugGoals
Minimum goal - type-safe references by slug. i.e. The blog collection would validate that
blog.data.authoris 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.authorwould 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