Skip to content

Cards

Turn a Markdown link list into a grid of navigation cards, and use the shortcode when cards need icons, badges or images.

Cards lay out a few parallel destinations so the reader can pick one at a glance: where to start, what to read next, which of three paths fits. Each card is a linked title with a sentence under it, and the grid adapts to the width of the page. A plain Markdown link list with {.cards} under it is all it takes, so the source stays an ordinary list on GitHub. Do not use cards for prose, which reads better as paragraphs, or for image collections, which belong in a gallery. A section’s own landing page usually needs no hand-written cards at all, because the theme can generate them from the child pages (automatic cards).

Shortest form

Put {.cards} on the line after a link list. Each link becomes a card title, and the text after — becomes its description:

Source
- [Get started](/docs/start/) — Start with OINK Starter, preview locally, then replace the site details with your own.
- [Authoring](/docs/write/) — How pages are organized and which front matter keys exist.
- [Customization](/docs/customize/) — Navigation, search, branding, languages.
{.cards}
  • Get started — Start with OINK Starter, preview locally, then replace the site details with your own.
  • Authoring — How pages are organized and which front matter keys exist.
  • Customization — Navigation, search, branding, languages.

The whole card is the click target, not just the title. The number of columns follows the available width, down to one on a phone, so there is no columns parameter.

Title-only cards

The description is optional: one link per item is enough.

Source
- [Callouts](/docs/components/callout/)
- [Tabs](/docs/components/tabs/)
- [Steps](/docs/components/steps/)
- [Fields](/docs/components/fields/)
{.cards}

Loose lists and longer descriptions

When a description needs more than a sentence, write a loose list: the link in one paragraph, the description in the next, and a blank line between items. The title then sits on its own line above the description. {.cards} still goes directly under the last paragraph, with no blank line in between.

Source
- [Front matter](/docs/write/frontmatter/)

  Every page parameter is defined here exactly once: type, default, accepted
  values, and the page that explains it.

- [Configuration](/docs/customize/config/)

  Site parameters grouped by feature, each row linking back to the guide that
  explains it.
{.cards}
  • Front matter

    Every page parameter is defined here exactly once: type, default, accepted values, and the page that explains it.

  • Configuration

    Site parameters grouped by feature, each row linking back to the guide that explains it.

Single-column list

For a directory of resources, where readers scan down rather than across, write {.cards .td-cards-list} instead of {.cards}. The cards become one column inside a single frame, separated by dividers, and each row grows with its description. The shortcode form takes cards variant="list" for the same result; any other variant warns and keeps the grid. Component presentation shows the grid and the list one after the other.

Icons and badges

A link list cannot carry icons, badges, images or a description with several paragraphs; the cards and card shortcodes can. icon is exactly one Font Awesome class pair, and badge is a short plain-text label beside the title.

Source
{{< cards >}}
{{< card title="Get started" link="/docs/start/" icon="fa-solid fa-rocket" badge="start here" >}}
Use OINK Starter and establish a local preview before customizing.
{{< /card >}}
{{< card title="Release and download pages" link="/docs/write/releases/" icon="fa-solid fa-box-open" badge="v0.5" >}}
A release card from `release_url` and `date`, plus a `checksums` block for download assets.
{{< /card >}}
{{< card title="Keyboard navigation" link="/docs/customize/keyboard/" icon="fa-solid fa-keyboard" >}}
Site-wide shortcuts and focus order.
{{< /card >}}
{{< /cards >}}
Get startedstart here

Use OINK Starter and establish a local preview before customizing.

An icon that is not a single class pair such as fa-solid fa-rocket warns, and the card renders without it.

Markdown bodies

The body of a card is ordinary Markdown, so it can hold inline code, emphasis, links and lists. Parameters such as title and badge are plain text.

Source
{{< cards >}}
{{< card title="Hugo Module" icon="fa-brands fa-golang" >}}
`hugo mod get github.com/pgsty/oink`. The recommended way; upgrading is one
version line.
{{< /card >}}
{{< card title="Git submodule" icon="fa-solid fa-code-branch" >}}
No Go installation needed:

- `git submodule add`
- the theme lands in `themes/oink`
{{< /card >}}
{{< /cards >}}
Hugo Module

hugo mod get github.com/pgsty/oink. The recommended way; upgrading is one version line.

Git submodule

No Go installation needed:

  • git submodule add
  • the theme lands in themes/oink

A card without link, like these two, shows its title in bold and links nowhere.

Cards with images

image puts a picture at the top of the card. It is looked up like ![alt](src): page resource, then the current section’s resources, then a global resource in assets/, then a static path such as /images/…, then a remote URL. Local images carry their width and height, so the page does not jump while they load.

Every image needs exactly one of image_alt="…", for an image that carries information, or decorative=true, for one that is only ornament. With both, the build warns and keeps the alt text; with neither, it warns and treats the image as decorative.

Source
{{< cards >}}
{{< card title="The OINK shell" link="/docs/about/features/" image="/images/oink.webp" image_alt="An OINK documentation page: sidebar, article and table of contents" >}}
Sidebar, article, table of contents — each can be turned off on its own.
{{< /card >}}
{{< card title="Release notes" link="/docs/write/releases/" image="/images/releasenote.webp" decorative=true >}}
A decorative cover: `decorative=true` emits an empty alt and screen readers skip it.
{{< /card >}}
{{< /cards >}}
An OINK documentation page: sidebar, article and table of contents

Sidebar, article, table of contents — each can be turned off on its own.

A decorative cover: decorative=true emits an empty alt and screen readers skip it.

Card images do not open in the image zoom dialog, because clicking anywhere on the card already follows its link.

Automatic cards on section pages

A section’s landing page (_index.md) can list its child pages as cards with no list in the source: the theme builds one card per child from its title, description and icon. This site turns that on for every section:

hugo.yml
params:
  ui:
    section_index: cards # list | cards

A section can choose differently in its own front matter, and cascade passes the choice down to its whole subtree:

content/docs/customize/_index.md
section_index: list

Generated and hand-written cards share the same styles; only the source of the data differs. Let the theme list a section’s child pages, because a hand-written list drifts out of step with the sidebar as pages are added or renamed. Write cards by hand for anything else, such as external links or recommendations from other sections. Configuration defines these keys.

Which form to use

What you want Which form
A grid of links with one-sentence descriptions {.cards} link list
Icons, badges, images cards / card shortcode
Lists, code or several paragraphs in the description cards / card shortcode
A card with no link cards / card shortcode
This section’s child pages nothing at all — section_index: cards

Use the link list whenever it can hold your content: it still reads as a list of links on GitHub, while shortcodes do not.

Output

Cards are pure CSS and load no script. In print, link-list cards stack in one column, shortcode cards fall back to two columns, and no card breaks across a page. In the page’s Markdown output, a link list stays as written and each shortcode card becomes a line - [Title](link) (badge) — description.

Parameter reference

The native form:

{.cards} , list attribute line , default—
On the line after an unordered list; unordered lists only. Add .td-cards-list for the single-column list
Everything else , Markdown , default—
The description: after — in a tight list, its own paragraph in a loose one

card parameters (cards itself takes only an optional variant="list"):

title , plain text , default—
Required, non-empty. The card title
icon , Font Awesome class pair , default—
For example fa-solid fa-rocket; a malformed value warns and is dropped
badge , plain text , default—
A small label beside the title
image , image source , default—
Page resource / global resource / static path / remote URL
image_alt , plain text , default—
With image, exactly one of this and decorative
decorative , boolean , defaultfalse
true marks a decorative image and emits an empty alt
Body , Markdown , default—
The card description

There is no cols, columns, accent, desc or color parameter. Unknown parameters warn and are ignored.

Limits

  • {.cards} works on unordered lists only; on a numbered list it does nothing.
  • {.cards} must sit directly under the list. A blank line before it, or indentation that puts it inside the last item, loses the marker without a warning: the build succeeds and the list stays a list. When no grid appears, check that line first.
  • A card outside cards, alone or inside another shortcode, warns and is skipped.
  • Only automatic section cards take a column count, through params.ui.section_index_columns; hand-written grids always follow the width.
  • A description longer than two lines belongs in a paragraph or a callout.