Skip to content

Markdown versions of all docs pages are available by appending .md to any docs URL.

card

Page as Markdown

Renders a styled card link with an optional icon or image, title and subtitle

Either call form works, and both produce identical HTML.

Note

This shortcode shadows Hextra’s card, so its behavior differs from the upstream one of the same name. See the Hextra shortcodes guide for the baseline.

Parameters

NameTypeRequiredDefaultDescription
titlestringyesThe card title.
headerstringnoAlias for title.
subtitlestringnoShort description below the title. Supports Markdown.
descriptionstringnoAlias for subtitle.
linkurlnoA direct URL for the card link, used as-is.
pathpathnoA section-relative path resolved to the current docs section, e.g. /tutorials/basic/.
iconstringnoName of an icon to render via utils/icon.html.
imageurlnoImage URL to display at the top of the card.
altstringnothe titleAlt text for the image.

Example

{{< card title="Shortcodes" subtitle="Every shortcode, grouped by what it does." path="/shortcodes/" icon="solo" >}}
Rendered output

Notes

Emits the same .section-card markup the parent-section auto-card grid uses, so a hand-written card looks identical to an auto-generated child card.

Give either link or path, not both. link is used verbatim; path is resolved against the current docs section.

icon is passed to Hextra’s utils/icon.html UNGUARDED, so a name that is not a key in data/icons.yaml calls errorf and aborts the build rather than degrading to a missing icon. utils/render-icon.html guards the same call and notes this file as the exception. The example above uses solo because that is the only key this module ships.

Title and subtitle are emitted as <span> with display: block from CSS, deliberately not as <p>. A percent-form call wraps the output in markdownify, and a nested <p> inside the <p> Goldmark adds triggers the browser’s auto-close-the-outer-paragraph behavior, which closes the <a> early and orphans the description.


Source: layouts/_shortcodes/card.html

Was this page helpful?