Figure

Renders an image inside a <figure> element with optional caption, link, and styling. Builds on Hugo’s built-in figure shortcode with Bootstrap classes for the theme’s look and feel.

A mountain landscape

A sample figure with a caption

Parameters

ParameterDescription
srcImage URL. Required.
altAlternative text. Falls back to caption (with markdown stripped) when omitted.
captionCaption text rendered below the image. Supports markdown.
titleOptional title rendered above the caption.
attrAttribution text rendered after the caption. Supports markdown.
attrlinkURL wrapping the attr text.
linkURL wrapping the image.
targettarget attribute for the link anchor (e.g. _blank).
relrel attribute for the link anchor.
classCSS classes applied to the <figure> element. Defaults to col-xs-24.
imgClassCSS classes applied to the <img> element. Defaults to img-responsive.
widthwidth attribute on the <img> element.
heightheight attribute on the <img> element.
view_full_sizeWhen truthy, renders a “View full size” link that opens the source image in a new tab. The link is only visible on extra small screens (xs breakpoint).

Examples

Basic usage

{{< figure src="https://picsum.photos/id/1018/800/450" alt="A mountain landscape" >}}

With caption and title

{{< figure
  src="https://picsum.photos/id/1018/800/450"
  title="Mountain"
  caption="A sample figure with a caption"
  attr="Lorem Picsum"
  attrlink="https://picsum.photos/"
>}}

For images that are hard to read at small screen widths (e.g. complex diagrams with fine-grain text), set view_full_size="true" to render a “View full size” link below the image. The link points to the image source and opens it in a new tab. It is only visible at the xs breakpoint — resize your browser window to see it.

{{< figure
  src="https://picsum.photos/id/1018/800/450"
  caption="Complex diagram"
  view_full_size="true"
>}}
A mountain landscape View full size

Resize the window to a narrow width to see the link