Ask your question and get a summary of the document by referencing this page and the AI provider of your choice
Version History
- "Release of the dynamic dictionaries feature"v9.0.06/12/2026
- "Merged dynamic records into variants — `variant` now accepts a string or an object"v9.1.06/26/2026
If you have an idea for improving this documentation, please feel free to contribute by submitting a pull request on GitHub.
GitHub link to the documentationCopy doc Markdown to clipboard
Dynamic Dictionaries
Intlayer supports two mechanisms for expressing content that goes beyond a single static dictionary per key. Each is declared through a top-level metadata field in the content file; no wrapper function is needed.
Open the table in a modal to view all data content clearly
| Feature | Metadata field | Selector in useIntlayer |
|---|---|---|
| Collections | item: N | { item: N } |
| Variants | variant: "name" or variant: { … } | { variant: "name" } or { variant: { … } } |
Both compose with the locale argument and support selective / lazy loading via importMode.
When to use which
- Collections — ordered list of items managed in separate files (FAQ entries, blog posts, products).
- Variants — named or structured content alternatives:
- a string variant for A/B tests, seasonal banners, or feature flags;
- an object variant for CMS records, user-specific copy, or any content addressed by a set of fields (the former "dynamic records").
Earlier versions exposed a separatemetafield for record-keyed content. It has been merged intovariant: pass an object tovariantinstead of usingmeta.
Selector disambiguation
A key may declare both dimensions at once (e.g. a collection whose items each have a variant). They are resolved in the order:
Copy the code to the clipboard
variant → itemSo { variant: "promo" } on a variant × item key returns every promo item as an array, and adding { item: 2 } narrows it to a single entry.