Skip to content

Commit

Permalink
Document removal of astro:content usage
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp committed Aug 23, 2024
1 parent 22188a9 commit c9828f3
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/content/docs/en/guides/upgrade-to/v5.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,23 @@ Decide if charset=utf-8 should not be set for md/mdx pages by default

Stuff!

### Changed: `astro:content` can no longer be used on the client (PLT2118)
### Changed: `astro:content` can no longer be used on the client

Prevent use of `astro:content` on the client
The `astro:content` module can no longer be used on the client. It was never intentionally exposed for client usage, leading to some developers to use it without realizing the limitations and bloat to client bundles.

If currently using in the client, consider instead passing the data you need through properties to your client components:

```astro
---
import { getCollection } from 'astro:content';
import ClientComponent from '../components/ClientComponent';
const posts = await getCollection('blog');
const postsData = posts.map(post => post.data);
---
<ClientComponent posts={postsData} />
```

#### What should I do?

Expand Down

0 comments on commit c9828f3

Please sign in to comment.