Solution 1 :

Remove linkPreface and try like this,

p #{ linkPreface }

each val in files
    -var url=val
    p #{url}
    a(href=`${url}`) #{val} </br>

Hope this helps!

Problem :

My pug code is like this, with linkPreface and val as passed values. I am using express on nodeJs.

p #{ linkPreface }

each val in files
    -var url=linkPreface+val
    p #{url}
    a(href=`${url}`) #{val} </br>

For the link part, the HTML is

<a href="http:/localhost:3000/folder/files">files</a>

For some reason whenever I click on or mouse over the link, I get http://localhost:3000/localhost:3000/folder/files, repeating the localhost:3000 part, which makes the link worthless. I am running this on Firefox. Any ideas how this is happening or how to fix it?

Comments

Comment posted by jday

Unfortunately I am still having a problem. The main issue I am finding is that pug is repeating elements of the url path, which makes the url that is created to be incorrect. Very frustrating when I am passing the right information to pug, but it messes it up.

By