Skip to content

Cannot render HTML with EJS template #240

@blake-edwards

Description

@blake-edwards

Here is the code I am using to render blog posts that will contain HTML. The HTML, as seen in the picture below, is rendered as text even though I used <%- in order to allow HTML. Is there a bug or is there something I am missing here?

   <% for(var i=0; i < result.length; i++) { %>   
              <div class="card">
                  <h2><%= result[i].title %></h2>
                  <h5>Posted: <%= result[i].posted %></h5>
                  <p><%- result[i].body %></p>
              </div>
     <% } %>

Output example:
screen shot 2018-09-15 at 2 36 24 am

If someone could explain to me why this current implementation is not working as expected that would be greatly appreciated!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions