无法渲染图像并链接到HBS文件Node.js

时间:2020-10-16 18:58:45

标签: node.js handlebars.js

我编写了以下代码来呈现我的hbs文件并通过电子邮件发送。

const emailTemplateSource = fs.readFileSync(path.join(__dirname, 'account_verification.hbs"), "utf8");
const template = hbs.compile(emailTemplateSource);

const htmlToSend = template({message: url.toString()});

当我发送文件时,它将不包含我设置的URL。如果我传递一个简单的字符串就可以了。

const htmlToSend = template({message: "this works fine"});

这是我的hbs文件采用网址的方式

<a  href= {{{message}}}>the lnk is</a>

此外,我的hbs文件中的图像也不会呈现。

0 个答案:

没有答案