All of my assets have fields for alt text and I understand how to access that info from an asset field, but can not figure out how to do it when an image has been inserted using Redactor.
Any help will be much appreciated!
Craft CMS Stack Exchange is a question and answer site for administrators, end users, developers and designers for Craft CMS. It only takes a minute to sign up.
Sign up to join this communityAll of my assets have fields for alt text and I understand how to access that info from an asset field, but can not figure out how to do it when an image has been inserted using Redactor.
Any help will be much appreciated!
For alt
tag content you can just click the image in the richtext field, hit the 'edit' button and add a title.
As far as I know there is no way to integrate an alt
text field (or any other fields) from assets without writing a custom redactor plugin. I posted a similar question here and the only solution was to use a matrix field instead. But I too would love to hear about any other options.
I think you simply can't set it from the redactor editor. But because asset meta fields are saved "globally" and not "per entry", you can enter the content from the CP's assets section.
But that probably won't help you much, because there's no out-of-box solution to output the fields data in your template. You would need to extent Redactor with a plugin and I'm not sure if you can modify how images are handled.
But like Douglas said, the best solution around this is to use Matrix instead.