Pug (Jade) 模板中标签的动态 url

she*_*aei 4 javascript node.js pug

我想动态更改 URL 文本。这是我在 Pug 模板引擎中使用的代码:

html
  head
    title=title
    <link rel="stylesheet" type="text/css" href="/css/style.css">
  body(style={'background-color': color })
    #content 
      .bigquestion=message
      | <div class='questionnumber'>
      a(href=`/question/`+ questionnumber) =questionnumber
      | / 
      =totalnumberofquestions
      | </div>
Run Code Online (Sandbox Code Playgroud)

我得到以下信息:

<div class='questionnumber'><a href="/question/98">question =questionnumber</a>98/ 135</div>
Run Code Online (Sandbox Code Playgroud)

我希望输出是这样的:

<div class='questionnumber'><a href="/question/98">question 98</a> / 135</div>
Run Code Online (Sandbox Code Playgroud)

有什么办法可以在 Pug 模板引擎中为 URL 使用动态文本?

我只能在这里找到静态文本示例。

Sun*_*ine 5

在文档中查看此部分。

https://pugjs.org/language/interpolation.html

html
  head
    title=title
    <link rel="stylesheet" type="text/css" href="/css/style.css">
  body(style={'background-color': color })
    #content 
      .bigquestion=message
      | <div class='questionnumber'>
      a(href=`/question/`+ questionnumber) #{questionnumber}
      | / 
      =totalnumberofquestions
      | </div>
Run Code Online (Sandbox Code Playgroud)