How to store a block of preformated HTML and return it to page using dato middleman gem

So I have a section of HTML that I need to store in its entirety within DatoCMS and then pull it back onto my page using dato middleman gem. When i try to do this using a text variable, multi-paragraph with presentation html editor the content of the variable gets wrapped in

tags and also has all the html tags encoded, so it appears a bit like pre formatted code, I see all the html tags etc displayed on the page, instead of the html div tags etc forming the page layout
What is the recommended variable type to do this without all the html tags being encoded?

If memory serves you can just use the same helpers in Rails for control over HTML escaping:

<%= raw(dato.model.field) %>

Doesn’t seem to help. I wonder if the issue is how the html is stored in Dato?

I think I have found what I need: CGI.unescapeHTML seems to convert the HTML encoded tags back into HTML

1 Like