-
Notifications
You must be signed in to change notification settings - Fork 9
AutoAlt
This filter will add images' native alt attribute to any images missing an alternative text. If the alt attribute is empty, the image's title will be used instead.
If the original source asset can't be located, the filename (sans extension) will be used.
A parameter $field can be used to make Retcon use any custom field for the alternative text.
Without parameters (default options)
{{ entry.body | retconAutoAlt }}Using a custom field with the handle alternativeText for the alt attribute
{{ entry.body | retconAutoAlt('alternativeText') }}With overwrite set to true_ (will overwrite any existing alt attributes)
{{ entry.body | retconAutoAlt(null, true) }}Don't fall back to the filename! It's an anti-pattern, after all.
{{ entry.body | retconAutoAlt(null, false, false) }}@field string|null
The handle for the custom field that Retcon should use for the alt text instead of the native alt attribute (or title)
Optional, default null
@overwrite boolean
If true, all alt tags are overwritten
Optional, default false
@allowFilenameAsAltText boolean
Makes Retcon use images' filenames as alt text, if neither the alt attribute or the title can be found
Optional, default true