-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[v6] Update astro:content docs
#12620
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: stable-live-collections
Are you sure you want to change the base?
[v6] Update astro:content docs
#12620
Conversation
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
|
Thank you Armand! Let's get @ascorbic to review this one! |
Co-authored-by: Matt Kane <m@mk.gg>
Co-authored-by: Matt Kane <m@mk.gg>
| </p> | ||
|
|
||
| `schema` is an optional Zod object to configure the type and shape of document frontmatter for a live collection. Each value must use [a Zod validator](https://github.com/colinhacks/zod). | ||
| An optional Zod object to configure the type and shape of your data for a live collection. Each value must use [a Zod validator](https://github.com/colinhacks/zod). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: is the schema property any different for the two collections? I'm wondering whether these should just be combined into one if not?
(Then, the line can say e.g. "When you define a schema in a live collection, it will take precedence over the live loader’s types when you query the collection."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Live collections can't have the function syntax for schemas (i.e. no image helper)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, as Matt said, because they don't share the same type it might be better to have them separated. But we could apply the same changes that you've suggested for loader to reduce the confusion between the two!
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
|
I pushed a new commit to add some links between the two I think everything seems okay if you want to merge this in your PR Sarah. We can always update the types later once we figured out:
And as reminder there is a TODO comment in my PR because a link would make sense here I think, but we'll need to describe the API to build a live loader first. And thank you both for your reviews! 🙌🏽 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you Armand! I believe this is good to merge, yes. It can still be updated in the other PR as necessary, but this was super helpful to keep the noise lower on that one!
|
Moving the type export to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work, just a couple small nits from me!
Co-authored-by: Yan <61414485+yanthomasdev@users.noreply.github.com>
|
I was annoyed about merging this with the TODO, so I pushed a new commit that adds docs for the Live Loader API! I haven't added much content in "Loader types" because we already describe that in the Content Collections guide. |
Description (required)
CollectionEntryis generic, maybe it's not important to show<collection>in the return type: it makes it easier to read and to be valid we should rather useCollectionEntry<CollectionKey>?)filePathandrenderedinCollectionEntrydetails)Note: I left a
TODOinside the file because we need to create the reference docs for live loaders and add a link!TODO: Document the live collections types
Related issues & labels (optional)
6.0,improve or update documentationI haven't created the types yet because, except
LiveDataEntryI'm not sure which ones to document yet. And some types (includingLiveDataEntry) are not exported fromastro:contentbutastro!See all the imports available from `astro:content`
See the imports related to live collections available from `astro`
I guess the import from
astroshould be fixed at least in thenextbranch in core.I also noticed:
ReferenceLiveEntrytype is available but it doesn't seem to be used anywhere?LiveCollectionKeyalias similar toCollectionKeyfor build-time collections, it would be nice I think.Nothing blocking here, but I was also surprised (because they were already deprecated in v4) to see we still have
getEntryBySlugandgetDataEntryByIdin v6! 👀 It seems they will be removed inv7.