I'm making a simple blog app for my site and fetching posts from array. When I try to use HTML tags in the posts I'm seeing they are not rendering, rest of page is ok.
Posts:
{"post_id":1,
"post_title":"Title",
"post_body":"This is a test text. <b> I'm testing HTML.</b> "} ....
Output in the page is :
This is a test text. <b> I'm testing HTML.</b>
Server-side:
var hbs = require('hbs');
// view engine setup
app.set('view engine', 'html');
app.engine('html', hbs.__express);
app.get('/post/:id', function(req, res) {
res.render('post_theme',
{post, title etc...});
});
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
<title>Page</title>
<!-- font css -->
<link href='http://fonts.googleapis.com/css?family=Open+Sans:300,400' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="/lib/semantic/build/packaged/css/semantic.css">
<link rel="stylesheet" type="text/css" href="/stylesheets/style.css">
<!-- js -->
<script src="/javascripts/jquery.js"></script>
<script src="/lib/semantic/build/packaged/javascript/semantic.js"></script>
</head>
<body id="home">
<div class="ui menu" >
....
</div>
<h3 class="ui header">{{title}}</h3>
<p>{{body}}</p>
</body>
</html>
Why HTML is not rendering?
(Actually I'm not sure this is Express question, I'm new to Web development.)
Solution:
Based on Andrew Counts answer I used three brackets and problem is solved. {{{...}}}
{{{body}}}