Wordpress Link Post to open in a new tab?

Hi All,

I’m using @nahumck action to post Link-Posts to Wordpress and it works great.

I’d ike to have the links opening in a new tab rather then leaving my blog. Is this at all possible? How to? (My lack of js is preventing me to find a solution!)

Any help would be greatly appreciated!!!

Thanks.
A

Markdown doesn’t support that natively, so you would need to introduce some step that modifies the Markdown links to HTML links (still valid in Markdown) with a target property of “_blank”.

See https://stackoverflow.com/questions/4425198/can-i-create-links-with-target-blank-in-markdown for some discussion of this.

But, many sites only apply this if the link is external to the site, so you may need some consideration of that.

You probably also need to consider the existing pages you’ve published on your blog. Presumably you want consistency of behaviour.

FWIW, I guess it would also be possible to have some embedded JavaScript on the pages rewrite links if you tagged them somehow; but that’s just shifting where the processing is done.

1 Like

I believe there are WordPress plugins that can automatically change all your links on your WP site to target new pages. The change may not happen ‘immediately’ on the WP side but it will eventually make the change. That way, you can push the process of adding the ‘target="_blank"’ to WP vs having to handling it via Drafts/Markdown.

I agree with @sgclark that this is something you want to manage at the Wordpress side of things based on templates or plug ins that handle the link type posts differently.