worthingtonjg / pendantbooks

0 stars 0 forks source link

Open links in new tab #12

Closed Bangledorf closed 3 years ago

Bangledorf commented 3 years ago

I do not seem to be able to use the attribute target = "_blank" to open the buy links in a new tab. A quick internet search said we need to enable attributes in the javascript. Is that done, and I'm just not implementing it right?

No idea if you want or need this, but I thought I would include the script the website said to add to enable the attributes in case it's of any use:

(function() { var links = document.links; for (var i = 0, linksLength = links.length; i < linksLength; i++) { if (links[i].hostname != window.location.hostname) { links[i].target = "_blank"; links[i].setAttribute("rel", "noopener noreferrer"); links[i].className += " externalLink"; } else { links[i].className += " localLink";
} } })();

worthingtonjg commented 3 years ago

At the end of the markdown for the link, you can just add: {:target="_blank"}