I had created a project on express handlebars which fetches some data from youtube API but the data had some special characters like &39# ( ' symbol) & ( & symbol) in the title Whenever I am rendering some data using handlebars, It is rendering the title as it is
SENDING DATA FROM Backend
router.get("/demo", (req, res, next) => {
res.render("demo", {
data:
"Smith & Jone' Car ", // simply means Smith & Jone's Car
});
});
RENDERING DATA VIA HANDLEBARS
<div class="bg-white container2 px-3 py-1">
<a href="#">
{{data}}
</a>
</div>
According to official docs from handlebars
use {{{data}}}
instead of
<div class="bg-white container2 px-3 py-1">
<a href="#">
{{data}}
</a>
</div>
use
<div class="bg-white container2 px-3 py-1">
<a href="#">
{{{data}}}
</a>
</div>
instead
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With