Passing Div ID in HTML through API

Hi, we’re trying to pass the id attribute in an HTML div or any element through the API. If we use lossless conversion then it works, but then the editor view becomes full HTML which makes post-editing harder. If we don’t use lossless conversion then it just strips the id out. Is there anyway around this?

Thanks!

No, the only ids that the native rich-text uses are for header tags and those are auto-generated from the tag contents. If you need ids on elements they’ll need to be added as raw html through a html card.

If it’s only certain blocks of content that need ids them you can wrap those parts in the <!--kg-card-begin/end: html--> comments as explained in https://ghost.org/docs/admin-api/#source-html

1 Like