Opening Links in a new tab when using Jekyll/Markdown

less than 1 minute read

So I was making a few minor updates to my page/portfolio earlier today and could for the life of me figure out how to get some of those links to open in a separate tab. A quick Google search points you to the fact that you should add target = '_blank' like you see below.

  ```html
  For Jekyll
  [Your Text](http://YourLink.com/){:target="\_blank"}

  For html
  <a href="http://YourLink.com/" target="_blank">Your Text</a>
  ```

Seemed simple enough but upon further research it looks like there is a vulnerability when using _blank (The _blank Target Vulnerability). Instead alter the code like so.

  ```html
  For Jekyll
  [Your Text](http://YourLink.com/){:target="\_blank" :rel="noopener noreferrer"}

  For html
  <a href="http://YourLink.com/" target="_blank" rel="noopener noreferrer">Your Text</a>
  ```

Check out this Medium Post from Alex Yumashev for more details on the vulnerability.

Happy blogging.