image

Displays an image from the repository’s assets/images directory with proper alt attributes.

{{< image src="path/to/some.png" alt="Alt text here" >}}

Options include:

  • src: The relative path of the image within assets/images. Do not include a leading a slash.

  • alt: The text to use in the alt attribute of the rendered img tag.

Both options must be specified, or unnamed parameters are supported, where the parameters represent src and alt in that order.

The image shortcode will first look for the specified path in assets/automated-screenshots. If it finds it, it checks to see if the path also exists in assets/screenshots, and if so, it raises a warning about the image being duplicated to recommend deleting the manual version. If an automated screenshot exists, image always favors it.

If the specified path doesn’t exist in automated-screenshots, the image shortcode checks screenshots and uses that image as normal. And if the path doesn’t exist in either screenshot directory, it throws an error.

Examples

Named parameters

{{< image src="sample/DO_Logo_icon_blue.png" alt="DigitalOcean" >}}

Renders to:

DigitalOcean

Unnamed parameters

{{< image "sample/DO_Logo_icon_blue.png" "DigitalOcean" >}}

Renders to:

DigitalOcean