Skip to main

Responsive Images

src/filters/images.js

responsive images

image()

Generate responsive image using eleventy img plugin

Params:

  • src {string}
  • alt {string | none} = none
  • attrs {object} = {}
  • sizes {string | none} = none

    Only required for small images, since the default is 100vw. See taxonomy data for named sizes like “card”, “media”, and “gallery”.

  • getUrl {boolean | none} = none

    Returns url to largest jpeg image instead of full HTML

Example:

{%- image src, "alt text", {"class":"my-image"}, "media" -%}

See Also