Adding classes to images

I am taking the first steps in using Netlify and Netlify CMS and have been looking around for a way to add CSS classes to the images I include in the content.

Is it even possible?

I looked into the documentation and all I could find was the description on how to add a featured image ( )

If it helps, I’m using Hugo

Hi @brunoamaral I don’t think you can add CSS classes to images from within the Netlify CMS. The CMS edits markdown, and you can’t change CSS classes from Markdown. The only way I can think of to accomplish this would be by creating a custom widget, but I don’t have any details on how you’d accomplish this.

I’m also in the situation where I would like to add classes to images in the CMS.
Just the fact that I can add a class = "someclassAddedInCMS" would be fantastic. @futuregerald do you have any example of a custom widget that perform this action? Any updates since Sep 23 where you posted this comment?

@brunoamaral did you arrive to some solution or ideas for this? Appreciate any leads on this.

90% sure you can do this with an editor component. You can make a copy of netlify-cms-editor-component-image and make it output whatever markup you want, just make sure the pattern still matches so its still recognized as an editor component on read. Then register it with a unique name and label.

Wow, this is way out of my knowledge, or probably you can show me where in the docs I can find more info about it? Pretty sure I can achieve the results I expect.

Might try asking in the slack where the developers hang out - this is pretty far outside the scope of what anyone else is going to be able to help you with, including our support staff :slight_smile:

You can join by following the slack link from here:

All right thanks, I will ask in slack now.