Including images in a markdown post in Hugo.
I wanted to be able to include images side by side in a post.
Hugo has some shortcodes which are snippets of code inside content files that call built-in or custom templates.
The
figureshortcode is an extension of the image syntax in markdown which does not provide a shorthand for the more semantic HTML5 element.
The documents have a list of the parameters that can be used with the figure shortcode including src, link, alt, title, caption, class, height, width etc.
I can’t see how any of the available attributes will allow me to position the images side by side. A custom shortcode could be written. For now I will just create a very simple markdown table and place each image in the cells in a row. To add a space in between I can use an empty cell. I am using the figure shortcode with the following attributes:
srcattribute for the URL of the image to be displatedcaptionattribute for a figure captionclassattribute with a value of “small text-center” to centre the caption and make the text smaller.widthattribute of the image
![]() Iris-Setosa |
![]() Iris-Versicolor |
![]() Iris-Virginica |
|---|
The URL for an image in the images folder where the page bundle has an _index.md file is ="./images/image.png".


