Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot render HTML with EJS template #240

Open
blake-edwards opened this issue Sep 17, 2018 · 2 comments
Open

Cannot render HTML with EJS template #240

blake-edwards opened this issue Sep 17, 2018 · 2 comments

Comments

@blake-edwards
Copy link

blake-edwards commented Sep 17, 2018

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!

@blake-edwards blake-edwards changed the title Cannot render HTML with EJS Template Cannot render HTML with EJS template Sep 17, 2018
@d4rckh
Copy link

d4rckh commented Sep 28, 2018

i have the same problem

@blake-edwards
Copy link
Author

@ndr3w221 Somehow the EJS template now displays HTML. I changed nothing in my code. Try using
in your text you are trying to display and get back to me. I am very confused but happy it is working!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants