Skip to content

Conversation

@ArmandPhilippot
Copy link
Member

@ArmandPhilippot ArmandPhilippot commented Nov 8, 2025

Description (required)

While reviewing #12604 I figured a PR to that branch would be easier than adding review comments so here's what I suggest to update. This PR mostly fixes code snippets, following HiDeoo's feedback, and rewords a section in the "Content Loader" reference to mention live loaders.

Here's the details:

  • astro:content:

    • Adds empty lines after code snippets (just a readability nit while checking the file)
    • Adds a missing title on a code snippet
    • Fixes the SchemaContext code snippet by adding a loader, and adds highlighting to bring attention on the right parts
    • nit: Replaces backticks with quotes around Content Collection because this is not code?
  • Content Loader reference:

    • Updates "What is a loader?" to talk about live loaders as well (not quite sure about the wording, but the idea is there)
    • Swaps a link in "What is a loader?": if people are on this page maybe they expect to be redirected to the right section on this page, then from there they be can redirected to the guide if needed.
    • Updates the code snippets to make them valid (remove schema, add missing imports)
    • nit: Replaces backticks with quotes around Content Collection because this is not code?
  • Content Collections guide:

    • Removes unnecessary imports from some code snippets
    • Adds necessary imports in some code snippets
    • Adds some missing code snippets title, mostly to code snippets using Astro.params
    • Updates the file() loader snippet to improve the parser visibility and prevent unnecessary overflow on large screens (we don't highlight the curly braces anymore though)
    • In "Cache hints", I replaced the "fetch data" comment with a fictive function to make the code "valid" and we had an issue with lastModified (the first one): item doesn't exist so I came up with a pseudo code that seems to do what the comment describes
    • It seems LiveCollectionValidationError and LiveEntryNotFoundError are not exported from astro:content but from astro/content/runtime, but looking at the most recent update in the roadmap proposal this should be available from astro/loaders?

Also noting that I did not fix a Typescript error we have in multiple places because of the default preset. For example, Astro.params.slug can be undefined so when we use it directly in a function we get:

Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
  Type 'undefined' is not assignable to type 'string'.ts(2345)

Related issues & labels (optional)

@ArmandPhilippot ArmandPhilippot added improve or update documentation Enhance / update existing documentation (e.g. add example, improve description, update for changes) code snippet update Updates a code sample: typo, outdated code etc. 6.0 labels Nov 8, 2025
@astrobot-houston
Copy link
Contributor

astrobot-houston commented Nov 8, 2025

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
en/guides/content-collections.mdx Source changed, localizations will be marked as outdated.
en/reference/content-loader-reference.mdx Source changed, localizations will be marked as outdated.
en/reference/modules/astro-content.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@ArmandPhilippot ArmandPhilippot changed the title [V6]: astro content collections [V6]: Various fixes in content collections pages Nov 8, 2025
Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look great, @ArmandPhilippot ! We've been focusing a lot on updating the content collections guide material, but yes, there is still some more generic text in here that needs updating. And, updating the code snippets to all be functional is great!

Left some thoughts re: what we could maybe do in astro-content. See what you think!

An optional Zod object or function that returns a Zod object to configure the type and shape of document frontmatter for a collection. Each value must use [a Zod validator](https://github.com/colinhacks/zod). (For live collections, see the [live `schema`](#schema-1) property.)

[See the `Content Collection` guide](/en/guides/content-collections/#defining-the-collection-schema) for example usage.
[See the Content Collections” guide](/en/guides/content-collections/#defining-the-collection-schema) for example usage.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! The backticks in text were bothering me deeply while reviewing this file in the other PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.0 code snippet update Updates a code sample: typo, outdated code etc. improve or update documentation Enhance / update existing documentation (e.g. add example, improve description, update for changes)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants