# Add Link Target or Rel Attribute from Post Editor

**URL:** <https://forum.ghost.org/t/add-link-target-or-rel-attribute-from-post-editor/11992>\
**Category:** Ideas\
**Created:** [February 14, 2020, 9:57am UTC](https://forum.ghost.org/t/add-link-target-or-rel-attribute-from-post-editor/11992 "2020-02-14T09:57:37Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![DavidDarnes](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/daviddarnes/32/3533_2.png) [@DavidDarnes](https://forum.ghost.org/u/DavidDarnes)\
**Post date:** [February 25, 2020, 9:57am UTC](https://forum.ghost.org/t/add-link-target-or-rel-attribute-from-post-editor/11992/2 "2020-02-25T09:57:37Z")

</div>

If anyone arrives here looking for a solution you can check out this thread:

> [@I want my external links to open in a new tab](https://forum.ghost.org/t/i-want-my-external-links-to-open-in-a-new-tab/9830/):
>
> Hello all I’d like all external links on my blog to open in a new tab. I’ve been reading the blog posts on this forum from people that had a similar question. I found some possible solutions that were posted here, but none of them seem to work on my Ghost website. The current version of Markdown seems to overrule attempts to manually create links like [Text goes here]([http://linkgoeshere](http://linkgoeshere)" target=“\_blank) and take out the target=”\_blank" part. Does anyone know if there is a way to overrule t…

> [@I want my external links to open in a new tab](https://forum.ghost.org/t/i-want-my-external-links-to-open-in-a-new-tab/9830/9):
>
> I think @jeff’s version expects jQuery to be present, here’s a vanilla JavaScript version:
> 
> ```auto
> [...document.querySelectorAll("a[href*='?xgtab&']")].forEach(link => {
> link.setAttribute("target", "moredetail");
> });
> 
> ```

---

_[View the full topic](https://forum.ghost.org/t/add-link-target-or-rel-attribute-from-post-editor/11992)._
