11ty makes use of shortcodes, which are essentially re-usable bits defined at the generator level.
For re-usable pieces of code defined at the template level, take a look at Nunjucks “macros.”
Elfin comes with a number of shortcodes built in that you might find helpful. If you’d like to add your own shortcodes, check out Extending Elfin.
This returns an entire image element for a Cloudinary asset. The primary advantage is the ability to easily construct a responsive image by passing a few arguments.