Feature request: ability to set target on invidual links and bookmarks

Hey Ghost team :+1: I think it would be very useful to be able to set the target of any link or bookmark created. Even in the admin navigation settings.

For usecases, often in posts I’ll have internal bookmarks to other pages or articles, so those are okay if they are targeted to the same window. But it would be good for bookmarks and links to external sites to target a new window/tab. Likewise, sometimes it would be nice to have some internal articles open in a new window.

I know there is some javascript way of accomplishing this, but it ended up breaking some social sharing buttons. So I think a simple select option for the target would be big help.

Hey @brendantko :wave:
It is possible to target specific links using JavaScript, using a method that won’t affect other links, to cause them to open in another tab. Here’s an example script that only targets links containing website.com:

const externalLink = document.querySelector("a[href*='website.com']");
	externalLink.setAttribute('target', '_blank');
	externalLink.setAttribute('rel', 'noopener noreferrer');
2 Likes

Thanks so much :smile:

1 Like