---
title: "Custom External Links In New Tab"
description: "By default in Ghost, all links in your posts are opened in the same browser window. Sometimes you may want to open external links in a new tab."
url: "https://www.priority.vision/docs/guides/custom-external-links-in-new-tab"
scope: shared
appliesTo: [Essence, Scope, Thoughts, Feed, Moment, Aspect, OnFlow, Thesis, Format]
lastUpdated: 2026-09-18
---

# External Links in New Tab

By default in Ghost, all links in your posts are opened in the same browser window. Sometimes you may want to open external links in a new tab. This can be done by adding `target="_blank"` and `rel="noopener noreferrer"` attributes to the link.

    [Code Injection](/docs/guides/custom-code-injection/) is required to add custom JS.

There is an API in the theme to add these attributes to all external links. You can use the following code snippet:

```html
<script>
window.pvs?.addExternalLinkAttributes?.();
</script>
```

This code snippet adds `target="_blank"` and `rel="noopener noreferrer"` attributes to all external links. If you want to change the target and rel attributes, you can use the following code snippet:

```html
<script>
window.pvs?.addExternalLinkAttributes?.({
    selector: 'a:not([target="_blank"])',
    target: '_blank',
    rel: 'noopener noreferrer',
});
</script>
```

## Documentation Index
> Fetch the complete documentation index at: https://www.priority.vision/docs/llms.txt
> Use this file to discover all available pages before exploring further.
