Cards Component

Example

Usage

{{< cards >}}
  {{< card link="../callout" title="Callout" icon="warning" >}}
  {{< card link="../callout" title="Card with tag" icon="tag" tag= "A custom tag" >}}
  {{< card link="/" title="No Icon" >}}
{{< /cards >}}
{{< cards >}}
  {{< card link="/" title="Image Card" image="https://source.unsplash.com/featured/800x600?landscape" subtitle="Unsplash Landscape" >}}
  {{< card link="/" title="Local Image" image="/images/card-image-unprocessed.jpg" subtitle="Raw image under static directory." >}}
  {{< card link="/" title="Local Image" image="images/space.jpg" subtitle="Image under assets directory, processed by Hugo." method="Resize" options="600x q80 webp" >}}
{{< /cards >}}

Card Parameters

ParameterDescription
linkURL (internal or external).
titleTitle heading for the card.
subtitleSubtitle heading (supports Markdown).
iconName of the icon.
tagText in tag.
tagColorColor of the tag: gray (default), yellow, red and blue.

Image Card

Additionally, the card supports adding image and processing through these parameters:

ParameterDescription
imageSpecifies the image URL for the card.
methodSets Hugo’s image processing method.
optionsConfigures Hugo’s image processing options.

Card supports three kinds of images:

  1. Remote image: the full URL in the image parameter.
  2. Static image: use the relative path in Hugo’s static/ directory.
  3. Processed image: use the relative path in Hugo’s assets/ directory.

Hextra auto-detects if image processing is needed during build and applies the options parameter or default settings (Resize, 800x, Quality 80, WebP Format). It currently supports these method: Resize, Fit, Fill and Crop.

For more on Hugo’s built in image processing commands, methods, and options see their Image Processing Documentation.

Tags

Card supports adding tags which could be useful to show extra status information.

{{< cards >}}
  {{< card link="../callout" title="Card with default tag color" tag="tag text" >}}
  {{< card link="../callout" title="Card with default red tag" tag="tag text" tagType="error" >}}
  {{< card link="../callout" title="Card with blue tag" tag="tag text" tagType="info" >}}
  {{< card link="../callout" title="Card with yellow tag" tag="tag text" tagType="warning" >}}
{{< /cards >}}
Last updated on