v2.0.2
Markdown
Every page in content/ is an .mdx file: Markdown plus JSX components. The quickest way to see everything in action is to open content/about/markdown.mdx, which contains headings, quotes, lists, tables, images, and footnotes. This guide recreates those patterns in smaller chunks.
File layout
- Nested folders map to URL paths (
content/guides/index.mdx→/guides/). index.mdxinside any directory becomes that directory’s landing page.- Run
npm run devto preview changes with live reload.
Front matter reference
Use YAML blocks to control metadata, canonical links, referenced manifests, and search behavior. The Frontmatter guide lists every supported key plus examples for the home page toggles.
Core Markdown patterns
Text, emphasis, headings
# Heading level 1 ## Heading level 2 Paragraphs can mix _italics_, **bold**, and `inline code` for props like `iiifContent`.Lists and blockquotes
1. Gather manifests.2. Draft copy.3. Link to supporting resources.[^1] - Highlight takeaways.- Pair prose with citations. > Blockquotes surface letters, diary entries, or reviewer notes.Images
This image comes from The town & pass of Boondi, in Rajpootana, a print in the British India Art demo.
 <Image src="https://iiif.dc.library.northwestern.edu/iiif/3/138a94b0-175a-4152-98c7-df58661ce7d5" isTiledImage height="400px" alt="The town & pass of Boondi, in Rajpootana" caption="Courtesy of Northwestern University Libraries."/>Tables and definition lists
| Feature | Syntax | Notes || ------- | ------ | ----- || Tables | `| col | col |` | Align columns with pipes and separators. || Code | ```` ```js const id = 1; ``` ```` | Add a language hint for syntax highlighting. | Term: Definition lists keep glossaries tidy.Code blocks and checklists
```txt filename="snippet.mdx"<Viewer iiifContent="https://api.dc.library.northwestern.edu/api/v2/works/4bdb5a22-6c7f-498d-8e6e-e49ea9bc4778?as=iiif" />``` - [x] Document the build inputs.- [ ] Leave one unchecked item as a reminder.Footnotes
Refer to prior research when needed.[^source] [^source]: Footnotes collect citations at the end of the page.Components inside Markdown
Embed Canopy components inline to tie Markdown narratives back to IIIF assets:
<Viewer />for a full manifest experience.<Image />for single-canvas figures.<Slider />for curated carousels.<ReferencedItems />/<References />to connect essays and works.
Because MDX is just React, you can pass props directly in the markup. Keep component usage minimal when possible so the prose stays readable in raw form.
Home page content
content/index.mdx controls the landing page. Compose Markdown and place components where you need them. Most sites lead with <Interstitials.Hero />, then follow up with <Container> sections, sliders, or bespoke CTAs.
---title: British India Art--- <Interstitials.Hero headline="Explore British India Art" description="Explore paintings and prints from Northwestern University Libraries and the Victoria and Albert Museum." links={[{ title: 'Browse works', href: '/search' }]}/> <Container> <p>Explore art from India through IIIF images and source records.</p> <ButtonWrapper> <Button href="/search" label="Browse works" /> <Button href="/about" label="About the project" variant="secondary" /> </ButtonWrapper></Container>Hero interstitial
<Interstitials.Hero /> renders at the top of the page and shows the featured manifests listed in canopy.yml, one at a time. Nothing in it moves until a visitor moves it.
- Previous and next sit over the slide, and a button for each slide sits below it. On a touch screen, a swipe moves to the slide beside it.
- Screen readers hear the slide a visitor moves to.
- Its labels come from
common.carouselinlocale.yml, so a Spanish page reads them in Spanish. - Without JavaScript, the first featured work shows alone.
collection: - https://api.dc.library.northwestern.edu/api/v2/collections/7ac5769f-a1d9-4227-a350-bf8bd8b1cddc?as=iiif - https://api.dc.library.northwestern.edu/api/v2/collections/94536627-cfdf-413c-852b-0cb16d986da3?as=iiiffeatured: - https://api.dc.library.northwestern.edu/api/v2/works/4bdb5a22-6c7f-498d-8e6e-e49ea9bc4778?as=iiif - https://api.dc.library.northwestern.edu/api/v2/works/c26591b2-994b-4ba3-a87e-9124419fa91b?as=iiif - https://api.dc.library.northwestern.edu/api/v2/works/d4c62d7f-f50d-4b29-85e0-5d380675bec7?as=iiifmetadata: - Subject - Date - Language - GenreBehavior notes:
- Featured manifests are normalized during the IIIF build so duplicates collapse to a single entry.
- If you omit
featured, Canopy falls back to a random manifest from the cached collection. - The hero supports props like
headline,description,links,variant,background,homeLabel, andheight. Pass them viacontent/index.mdx(e.g.,<Interstitials.Hero headline="Explore" />). - Set
variant="centered"to lay the hero down the page: the headline large and centered, the description and links under it, and the featured works below in a raised card. The carousel behaves as it does in the defaultfeaturedlayout. headlinetakes a string, or words with markup in them:headline={<>Explore <em>the collection</em></>}.- Set
variant="breadcrumb"to render a centered, copy-driven hero with a breadcrumb that mirrors the current docs path; override the leading crumb withhomeLabelwhen needed.
<Interstitials.Hero variant="centered" headline="Explore British India Art" description="Paintings and prints from Northwestern University Libraries and the Victoria and Albert Museum." links={[{ title: 'Browse works', href: '/search' }]}/><Interstitials.Hero variant="breadcrumb" headline="Explore British India Art" description="Explore paintings and prints from Northwestern University Libraries and the Victoria and Albert Museum." links={[{ title: 'Browse works', href: '/search' }]}/>Custom content region
Everything beneath the hero comes from the Markdown body. Compose <Container /> wrappers, prose, <RelatedItems />, or IIIF components (Viewer, Slider, ReferencedItems) to introduce the project. The docs layout wrapper provides typography defaults so you can focus on the content itself.
<RelatedItems top={3} /> renders one slider per metadata label defined in canopy.yml. Each slider fetches a generated /api/facet/<label>/<value>.json collection and links cards back to the related work page.
Tips:
- Limit the
metadatalist to fields with a reasonable number of distinct values; each unique value generates its own IIIF Collection file. - Use the
topprop on<RelatedItems />to restrict the number of sliders (top={2}renders two label buckets). - Override slider spacing with the
sliderOptionsprop or by editingpackages/app/ui/src/iiif/sliderOptions.js.
Checklist when editing the home page
- Add descriptive
titleanddescriptionfront matter for accurate SEO and social cards. - Keep hero copy short; the manifest label and summary already surface detailed provenance.
- Use
<Button />for primary actions and<Button variant="secondary" />for tertiary links to maintain consistent styling. - Wrap embedded sliders or viewers in
<section>and heading pairs so the table of contents and skip links stay meaningful.
Layout components
Use layout primitives from @nulib/canopy/ui/server to keep spacing and call-to-action styling consistent across MDX pages.
Container
Wrap sections in a centered, padded shell that respects the project’s max width. Add utility classes via className to tweak backgrounds or spacing.
<Container> Textual content goes here. </Container>| Attribute | Values | Purpose |
|---|---|---|
className | string (optional) | Extends the base spacing/width utilities with custom classes. |
Button
Render calls to action with the Canopy button styles. label provides the text while variant toggles between primary and secondary treatments.
<Button href="/about" label="Read more" target="_blank" variant="primary" />| Attribute | Values | Purpose |
|---|---|---|
label | string | Text shown inside the button. |
href | string | Destination URL for the anchor element. |
variant | primary, secondary | Controls color treatment; defaults to 'primary'. |
target | string (optional) | Anchor target (_blank, etc.); auto-adds rel="noopener noreferrer". |
rel | string (optional) | Custom rel attribute; overrides the auto-generated value when present. |
className | string (optional) | Appends classes before the variant modifier. |
On a <Band>, each variant takes the band's colors: the primary white with black words, the secondary a white edge.
ButtonWrapper
Arrange multiple buttons with a consistent gap. Useful for callouts with several actions.
<ButtonWrapper> <Button href="/search" label="Browse" /> <Button href="/about" label="About" variant="secondary" /></ButtonWrapper>| Attribute | Values | Purpose |
|---|---|---|
className | string (optional) | Extends the default flex and gap utilities. |
Swoosh
<Swoosh> drew a brush stroke under a word or two in Canopy 2.0.0 and 2.0.1. Since 2.0.2 it draws nothing, and its words read as they are; MDX written with it keeps working, and you can take it out when you like.
Feature
Introduces a section: a short eyebrow, a title, and a sentence or two under it, a step larger and muted. Anything else you put inside, such as a <Button>, follows the words.
<Feature eyebrow="Search" title="Find anything in the collection"> Every work, by its title, subjects and summary. <Button href="/search" label="Search the collection" /></Feature>| Attribute | Values | Purpose |
|---|---|---|
title | string or Markdown nodes | The section's title, a heading. |
eyebrow | string (optional) | A short label above the title, read with it as one heading group. |
headingLevel | 1 to 6; defaults to 2 | The title's heading level. Pick the level the section has in the page's outline. |
align | start, center | Where the words sit; defaults to 'start'. |
Band
A call to action on black, white words, the same in light and dark mode. Put a heading, a sentence and buttons in it.
<Band> <h2>Have an idea for a project?</h2> <p>Start from a template, point it at your IIIF collection, and publish.</p> <ButtonWrapper> <Button href="/about/get-started" label="Get started" /> <Button href="/docs" label="Documentation" variant="secondary" /> </ButtonWrapper></Band>| Attribute | Values | Purpose |
|---|---|---|
align | center, start | Where the words sit; defaults to 'center'. |
className | string (optional) | Adds classes to the band. |
CanopyFooter
The site's footer, used in content/_app.mdx. Whatever you put inside it shows as it always has. Give it a logo, title or description and it opens with the site's mark, name and a sentence about it; give it links and they sit in a row under a line at its foot. With theme.appearance: auto in canopy.yml, that row holds the appearance switch too.
<CanopyFooter logo={Logo} description="A digital collection of IIIF works, with context and narrative." links={[ {href: "/about", label: "About"}, {href: "https://github.com/your/repository", label: "Code"}, ]}> <p>Copyright 2026 Site Title.</p></CanopyFooter>| Attribute | Values | Purpose |
|---|---|---|
logo | component (optional) | The site's mark, as CanopyHeader takes it. |
title | string (optional) | The site's name beside the mark; defaults to canopy.yml's title. |
description | string (optional) | A sentence about the site, under its name. |
links | {href, label} list (optional) | Links in the row at the footer's foot. |
className | string (optional) | Adds classes to the footer. |