5. Add Images

Add a small or large image with a Doks shortcode (add extra classes), or use markdown (portability). Images are lazyloaded, blurred up, and responsive.

On this page

Place your images in a page bundle, like so:

  1. ..
  2. ├── blog/
  3. ├── say-hello-to-doks/
  4. ├── index.md
  5. └── say-hello-to-doks.png
  6. └── _index.md
  7. └── _index.md

See also the Hugo docs: Page Bundles

Markdown

Add an image

An <img> element is used for small images, a <figure> element for large images. Set smallLimit in ./config/_default/params.toml, e.g. smallLimit = "360".

Example

  1. ![Image](day-and-night-escher.jpg "Day and Night, 1938 — M.C. Escher")

Will be processed into:

Image

Image

Day and Night, 1938 — M.C. Escher

See also the Markdown Guide: Images

Shortcodes

Add a small image

Using img, src, and data-src.

💡

Valid image formats are: webp, jpg, png, tiff, bmp, and gif.

Add a small image in your page bundle to your page using shortcode img-simple.

Example

  1. {{< img-simple src="square.png" alt="Square" class="border-0 rounded-circle" >}}

Will be processed into:

Square

Add a large image

Using figure and figcaption with img, src, and data-srcset. With noscript fallback.

💡

Valid image formats are: webp, jpg, png, tiff, and bmp.

Add a large image in your page bundle to your page using shortcode img.

Example

  1. {{< img src="rectangle.png" alt="Rectangle" caption="<em>Rectangle</em>" class="border-0" >}}

Will be processed into:

Rectangle

Rectangle

Rectangle