dynamic链接与翡翠

使用Jade + Express + Node.js + Mongoose + MongoDB作为我的应用程序,但是我遇到的这个问题可能在Jade中:

我有一些代码如下,打印标题,作者的职位列表

div#articles -each post in records div.article #{post.title} was written by #{post.author} <a href ="#{post.title}"> Link to Article </a> 

现在我想链接在书面翡翠而不是HTML,但是当我更换线

 a(href='#{post.title}') 

它链接到/#{post.title}而不是像/ newpost1这样的variables名。 这样做

 a(href=#{post.title}) 

返回一个错误。 我确定这是一个语法问题,但是我在GitHub文档中找不到解决scheme

       

网上收集的解决方案 "dynamic链接与翡翠"

很确定你可以做:

 a(href=post.title) 

玉:

 - var records = [ { title: 'one', author: 'one' }, { title: 'two', author: 'two' } ]; div#articles -each post in records div.article | #{post.title} was written by #{post.author} a(href =post.title) Link to Article 

HTML:

 <div id="articles"> <div class="article">one was written by one<a href="one">Link to Article</a></div> <div class="article">two was written by two<a href="two">Link to Article</a></div> </div>