How to open links in New Tab in Ghost CMS

How to open links in New Tab in Ghost CMS

The TLDR answer

You know how important it is for your blog to keep users in your domain rather than sending to some other website, but still, there would be scenarios where you have to add links to other domains and your users will click those links. By default Ghost would open the link on the same page, so now you lose your user.

How can you solve this problem? You can open the link as a new page in the background. To do this you need to write the snippet below and add it to the code injection block inside the settings

<script type='text/javascript'>
  $( document ).ready(function() {
  	$(".post-content a").attr("target","_blank");
  });
</script>

Go to this link https://<your domain>/ghost/#/settings/code-injection and then paste the above snippet in the Site Footer section. And that's it.

You will now see all the new links in your Ghost CMS blog opening in a new tab.