VirtusLab-Open-Source/astro-strapi-loader
Integration of Astro with Strapi CMS that enables easy data loading from Strapi Content API
Actual rules from this repo
Path in source repo: .cursor/rules/astro-strapi-loader.mdc · format: mdc
---
description: Strapi 5 + @sensinum/astro-strapi-loader — content.config.ts, populate, qs, locales
globs: "**/content.config.ts"
alwaysApply: false
---
# Astro Strapi Loader (this repo)
- Docs: [`.ai/AGENTS.md`](.ai/AGENTS.md), [`.ai/astro-strapi-loader/SKILL.md`](.ai/astro-strapi-loader/SKILL.md).
- **Query objects:** Match [REST API parameters](https://docs.strapi.io/cms/api/rest/parameters)—nested **objects** for `populate` / `filters` / `pagination`, plus **array** or **string** where the table allows (`sort`, `fields`, `populate` as dot paths). **Never** hand-author the final `?` string; **`qs.stringify`** (or the loader) serializes. **Anti-pattern:** inline query text.
- **Loader:** pass a **plain** `query` object only. **Custom HTTP:** `qs.stringify(q, { encodeValuesOnly: true })`. Not `URLSearchParams` for deep `populate`.
- **Large configs:** **named fragments** (hero, seo, DZ) composed with `...spread`; optional **separate file** of exported query objects shared with any runtime `fetch` (same object → same `qs` output).
- **Dynamic zone:** `populate: { <dzField>: { on: { '<uid>': { populate: ... } } } }`—each component uid its own `populate` subtree.
- **Locales:** `locale` on each def; use **`collectionName`** to split one Strapi type into many Astro collections (e.g. per language suffix), or one collection with `locale: string[]` and `locale:id` / `_locale` in data.
- **Merging `generateCollections`:** spread results from one or many `await` calls; loop + merge per def if you need per-endpoint error isolation.
- **Runtime:** `getCollection` / `getEntry` from `astro:content`.
Loader code: `src/utils/loader.ts`, `src/utils/strapi.ts`.
Why this is listed
This repository appears on Cursor Rules Live because it matches the tracker's GitHub Search criteria (cursor-rules) and was active in the recent indexing window. The tracker refreshes every 15 minutes, so the metadata above reflects the state at the most recent index pass. If the data here looks stale, the source repository may have been archived or moved out of the tracked topic; the next cron tick will reconcile.