pugjs / pug

Pug – robust, elegant, feature rich template engine for Node.js
https://pugjs.org
21.54k stars 1.96k forks source link

href in an a tag doesnt work #3390

Open GrantBaum opened 1 year ago

GrantBaum commented 1 year ago

Pug Version: your version number here 8.15.0 Node Version: your version number here 8.15.0

Input JavaScript Values

Input Pug

a(href='views/about.pug') About

Expected HTML

should take me to about.pug

error

cannot GET about.pug

Additional Comments

yashdodani commented 1 year ago

Can you provide more clarity on your issue, as considering only this much information about the issue is difficult. Please provide with more code and comments to make this issue more clear and understandable.

webdiscus commented 1 year ago

@GrantBaum

In href must be a public path to HTML file. Pug engine not analyse content of string attributes.

wrong

a(href='views/about.pug') About

You must know the path to the compiled HTML page yourself. For example, if Pug templates are compiled into <PROJECT_PATH>/dist/pages/ directory, then correct href will be :

a(href='pages/about.html') About