I want to dynamically change the URL text. This is the code I am using in my Pug template engine:
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>
I am getting the following:
<div class='questionnumber'><a href="/question/98">question =questionnumber</a>98/ 135</div>
I want the output to be something like this:
<div class='questionnumber'><a href="/question/98">question 98</a> / 135</div>
Is there any way that I can use a dynamic text for the URL in Pug templating engine?
I was able to only find static texts examples only here.
Check out this section in the documentation.
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>
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