How to place target="_blank" in pug

I have the following links in a pug file:

 a.button.expanded(href=`${projects[id].live_link}`) Live Demo
        a.button.expanded(href=`${projects[id].github_link}`) GitHub Repo

I am trying to add target=_blank" like this

a.button.expanded(href=`${projects[id].live_link}target="_blank"`) Live Demo

but that does not seem to be working, can someone help?

1 answer

  • answered 2019-01-11 05:26 Sridhar

    You need to add , to separate attributes

    Tag attributes look similar to HTML (with optional commas), but their values are just regular JavaScript.

    Doc : Pug - Attributes

    so,

    a.button.expanded(href=`${projects[id].live_link}`, target="_blank") Live Demo