v1.14.1
Use metadata collections
For every label listed under metadata in canopy.yml, Canopy creates derived IIIF Collections: one
per label and one per label/value pair. These files power /metadata, related sliders, and the
home-page highlights. You can also reference them directly in MDX components like <Viewer /> and
<Slider />.
1. Configure metadata labels
Add the labels you want to browse to the metadata array. This example uses the Indian Paintings
on Mica Collection from the British India art demo.
collection: - https://api.dc.library.northwestern.edu/api/v2/collections/7ac5769f-a1d9-4227-a350-bf8bd8b1cddc?as=iiifmetadata: - Subject - Date - GenreThe labels must match the manifest metadata labels (case-insensitive during the build). After editing
canopy.yml, restart npm run dev so the IIIF cache refreshes.
2. Verify the generated collections
The build creates a Collection for the subject “Mica.” Open its URL in your browser to check the included Manifests:
/api/facet/subject/mica.jsonIf you run the project at a subpath via CANOPY_BASE_PATH, prepend it when viewing the JSON in your
browser (e.g., /canopy/api/facet/subject/mica.json). Delete .cache/iiif and rebuild if you
change the metadata list but still see stale output.
3. Embed a collection in MDX
Use the generated collections to power sliders or viewers on custom pages. For example, to add a carousel of Manifests whose subject is “Mica”:
---title: Paintings on Mica--- # Paintings on Mica Explore watercolors from Northwestern University Libraries' Indian Paintings on Mica Collection. <Slider iiifContent="/api/facet/subject/mica.json" />You can swap <Slider /> for <Viewer /> to render a browsable IIIF collection instead of cards.
<ReferencedItems /> continues to use the referencedManifests field, so use it when you need a
hand-picked bibliography rather than an automatically generated list.
4. Tips
- Keep label names short but descriptive; they appear verbatim in UI headings.
- Removing a label from
canopy.ymldeletes the associated/api/facet/**files on the next build. - Use
metadatalabels consistently across manifests. Sparse or inconsistent values make facets less useful, even though the collections will still be generated.