Legacy flags
Ta treść nie jest jeszcze dostępna w Twoim języku.
To help some users migrate between versions of Astro, we occasionally introduce legacy
flags.
These flags allow you to opt in to some deprecated or otherwise outdated behavior of Astro in the latest version, so that you can continue to upgrade and take advantage of new Astro releases until you are able to fully update your project code.
Collections
Section titled CollectionsType: boolean
Default: false
astro@5.0.0
Beta
Enable legacy behavior for content collections (as used in Astro v2 through v4)
If enabled, data
and content
collections (only) are handled using the legacy content collections implementation. Collections with a loader
(only) will continue to use the Content Layer API instead. Both kinds of collections may exist in the same project, each using their respective implementations.
The following limitations continue to exist:
- Any legacy (
type: 'content'
ortype: 'data'
) collections must continue to be located in thesrc/content/
directory. - These legacy collections will not be transformed to implicitly use the
glob()
loader, and will instead be handled by legacy code. - Collections using the Content Layer API (with a
loader
defined) are forbidden insrc/content/
, but may exist anywhere else in your project.
When you are ready to remove this flag and migrate to the new Content Layer API for your legacy collections, you must define a collection for any directories in src/content/
that you want to continue to use as a collection. It is sufficient to declare an empty collection, and Astro will implicitly generate an appropriate definition for your legacy collections: