---
title: "Ghost Sponsored Links: 3 Easy Ways to Add rel=”sponsored” Fast"
id: "760"
type: "post"
slug: "easy-way-to-handle-nofollow-sponsored-links-in-ghost-cms-blog"
published_at: "2026-03-02T16:52:56+00:00"
modified_at: "2026-05-11T11:00:55+00:00"
url: "https://playdevhub.com/easy-way-to-handle-nofollow-sponsored-links-in-ghost-cms-blog/"
markdown_url: "https://playdevhub.com/easy-way-to-handle-nofollow-sponsored-links-in-ghost-cms-blog.md"
excerpt: "Automatically add rel=\"sponsored\" to affiliate links in Ghost using a simple script that saves time and keeps your SEO clean."
taxonomy_category:
  - "Web Development"
taxonomy_post_tag:
  - "Ghost CMS"
  - "SEO"
---

[Web Development](https://playdevhub.com/web-development/)

# Ghost Sponsored Links: 3 Easy Ways to Add rel=”sponsored” Fast

Automatically add rel="sponsored" to affiliate links in Ghost using a simple script that saves time and keeps your SEO clean.

2 March 2026

[https://playdevhub.com/author/playdevhub/](https://playdevhub.com/author/playdevhub/)
by [Minarin](https://playdevhub.com/author/playdevhub/)

## **How to Add rel=”sponsored” to Ghost Sponsored Links Automatically**

Heads up! If you’re using affiliate links or sponsored stuff, you gotta let Google know. They expect you to tag those kinds of links with `rel=sponsored`. If you don’t, it could mess with your site’s rep and how it shows up in search results.

But, honestly, who wants to edit every single link by hand? It’s boring, and you’re bound to miss one. That’s where this comes in.

I’m going to walk you through a simple way to use a bit of JavaScript to automatically add `rel=sponsored noopener noreferrer` to those special links in your Ghost blog. Plus, it’ll make those links open in a new tab – keeping people on your site.

No awkward plugins or complicated stuff. Just a simple script you can drop right into Ghost.

```
While this JavaScript trick simplifies link tagging for Ghost, ensuring your WordPress site follows all technical SEO best practices can further boost your rankings. Dive deeper into our comprehensive WordPress SEO Checklist 2026: 10 Powerful Fixes to Boost Rankings Fast for more powerful fixes.
```

## Table of Contents

## **Why Ghost Sponsored Links Need rel=”sponsored”**

Google wants you to clearly mark affiliate or sponsored URLs with `rel=sponsored`. It tells them, Hey, this is a promotional link.

Doing it yourself every time? Not fun and easy to screw up.

This script helps by:

- Finding the external links you marked in your posts.
- Adding `rel=sponsored noopener noreferrer` to help with SEO and keep things secure.
- Making those links open in a new tab (`target=_blank`) so people don’t leave your site.
- Getting rid of your special marker from the link, so readers never see it.

Once it’s set up, you won’t even know it’s there!

## **How to Mark Sponsored Links in Ghost CMS**

### Step 1: Mark Your Links in Ghost

The script needs a secret sign to know which links are sponsored.

When you add a sponsored or affiliate link in Ghost, just tack on this little bit at the end:

```
?sponsored
```

Like this:

```
https://example.com/product?sponsored
```

If the link already has other stuff at the end, use this instead:

```
https://example.com/product?ref=123&sponsored
```

That `?sponsored` or `&sponsored` thing is just for the script. Nobody will see it but the script, which deletes it before anyone sees the page.

Think of it as a secret code!

### Step 2: Add the Script to Your Ghost Site

To get this magic working, paste the JavaScript code into your Ghost footer. Putting it there makes sure the page loads first, so nothing gets slowed down.

Here’s how:

1. Log in to your **Ghost Admin** area.
2. Go to **Settings**.
3. Click on **Code Injection**.

    1. Scroll down to **Site Footer**.

    1. Paste the script below.

    1. Hit **Save**.

Here’s the script you need:

```
<script>
document.addEventListener('DOMContentLoaded', function() {
    // Select all links within the Ghost post content area
    var links = document.querySelectorAll('.gh-content a');
    for (var i = 0; i < links.length; i++) {
        // Check if the link goes to a different website
        if (links[i].hostname !== window.location.hostname) {
            
            // Check if you've marked the link as sponsored in the editor
            if (links[i].href.includes('?sponsored') || links[i].href.includes('&sponsored')) {
                
                // 1. Add the sponsored attribute for SEO and security
                links[i].setAttribute('rel', 'sponsored noopener noreferrer');
                
                // 2. Make the link open in a new tab
                links[i].setAttribute('target', '_blank');
                
                // 3. Clean the "?sponsored" tag from the URL so visitors don't see it
                links[i].href = links[i].href.replace('?sponsored', '').replace('&sponsored', '');
            }
        }
    }
});
</script>
```

### One thing to remember

The `.gh-content a` part looks for links inside your normal Ghost content. Most themes use this setup, so you probably don’t need to change anything.

### Step 3: Check That It Works

After you save, the script will start doing its thing.

To make sure it’s all working:

1. Open a post with a link that has `?sponsored` at the end.
2. Right-click the link and click **Inspect**.
3. Look at the code for the link, and make sure it has:
  - `rel=sponsored noopener noreferrer`
  - `target=_blank`

Then, click the link!

It should pop open in a new tab, and you shouldn’t see the `?sponsored` bit in the address bar. If all that’s true, you’re good to go!

## All Done!

One thing I like about this setup is how lightweight it feels. No extra plugin overload, no complicated SEO tools running in the background, and everything stays pretty manageable even on smaller Ghost sites.

And if your project grows beyond a simple blog later on, having reliable infrastructure in place helps a lot too. **[Services like Senko Digita](https://go.platigame.com/senko-hosting)**[l](https://senko.digital?utm_source=chatgpt.com)
 can work well for hosting landing pages, self-hosted tools, game servers, or larger affiliate projects without making the setup overly complicated. According to their site, they also offer budget VPS plans, dedicated servers, storage VPS, and a referral program with recurring payouts.

## FAQ About Ghost Sponsored Links

### What are Ghost sponsored links?

Ghost sponsored links are outbound links in your Ghost CMS blog that include affiliate, paid, or promotional URLs. These links should use the `rel="sponsored"` attribute to signal to search engines that they are commercial in nature.

### Do I need to use rel=”sponsored” for affiliate links in Ghost?

Yes. Google recommends using `rel="sponsored"` for affiliate links and paid placements. It helps search engines understand that the link is promotional and ensures your site follows SEO best practices.

### What is the difference between rel=”sponsored” and rel=”nofollow”?

The `rel="sponsored"` attribute is specifically designed for paid or affiliate links, while `rel="nofollow"` is a more general signal that tells search engines not to pass ranking signals. For Ghost sponsored links, `sponsored` is the more accurate and recommended option.

### Can I use rel=”sponsored” and rel=”nofollow” together?

Yes, you can combine them (`rel="sponsored nofollow"`), but in most cases, using `rel="sponsored"` alone is enough. Google treats it as a clear indicator of commercial intent.

### How do I automatically add rel=”sponsored” in Ghost CMS?

You can use a simple JavaScript script added via Ghost Code Injection (Site Footer). The script detects links marked with a parameter like `?sponsored` and automatically adds `rel="sponsored noopener noreferrer"` and `target="_blank"`.

### Will visitors see the ?sponsored parameter in the URL?

No. The script removes the `?sponsored` or `&sponsored` parameter before the page fully loads, so users never see it in the browser address bar.

### Does adding rel=”sponsored” affect SEO rankings?

Using `rel="sponsored"` does not directly improve rankings, but it protects your site from potential penalties related to unmarked paid links and improves overall SEO compliance.

### Related posts:

1. [Add Table of Contents in Ghost CMS: 4 Easy Steps (No Theme Edit)](https://playdevhub.com/add-table-of-contents-ghost-cms-no-theme-edit/)
2. [WordPress SEO Checklist 2026: 10 Powerful Fixes to Boost Rankings Fast](https://playdevhub.com/wordpress-seo-technical-faq/)
3. [How to Set Up Robots.txt and Sitemap for Proper Website Indexing](https://playdevhub.com/robots-txt-and-sitemap-setup/)

- [Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fplaydevhub.com%2Feasy-way-to-handle-nofollow-sponsored-links-in-ghost-cms-blog%2F)
- [X](https://x.com/intent/tweet?url=https%3A%2F%2Fplaydevhub.com%2Feasy-way-to-handle-nofollow-sponsored-links-in-ghost-cms-blog%2F&text=Ghost+Sponsored+Links%3A+3+Easy+Ways+to+Add+rel%3D%E2%80%9Dsponsored%E2%80%9D+Fast)
- [Pinterest](https://pinterest.com/pin/create/button/?url=https%3A%2F%2Fplaydevhub.com%2Feasy-way-to-handle-nofollow-sponsored-links-in-ghost-cms-blog%2F&description=Ghost+Sponsored+Links%3A+3+Easy+Ways+to+Add+rel%3D%E2%80%9Dsponsored%E2%80%9D+Fast)
- [Linkedin](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fplaydevhub.com%2Feasy-way-to-handle-nofollow-sponsored-links-in-ghost-cms-blog%2F&title=Ghost+Sponsored+Links%3A+3+Easy+Ways+to+Add+rel%3D%E2%80%9Dsponsored%E2%80%9D+Fast)
- [Whatsapp](https://api.whatsapp.com/send?phone=&text=https%3A%2F%2Fplaydevhub.com%2Feasy-way-to-handle-nofollow-sponsored-links-in-ghost-cms-blog%2F)
- [Reddit](https://www.reddit.com/submit?url=https%3A%2F%2Fplaydevhub.com%2Feasy-way-to-handle-nofollow-sponsored-links-in-ghost-cms-blog%2F&title=Ghost+Sponsored+Links%3A+3+Easy+Ways+to+Add+rel%3D%E2%80%9Dsponsored%E2%80%9D+Fast)
- [Email](mailto:?subject=Ghost%20Sponsored%20Links%3A%203%20Easy%20Ways%20to%20Add%20rel%3D%E2%80%9Dsponsored%E2%80%9D%20Fast&body=https%3A%2F%2Fplaydevhub.com%2Feasy-way-to-handle-nofollow-sponsored-links-in-ghost-cms-blog%2F)
- [#](#)

[https://playdevhub.com/author/playdevhub/](https://playdevhub.com/author/playdevhub/)
### [Minarin](https://playdevhub.com/author/playdevhub/)

I write about tech, gaming, and AI. I’m always on the lookout for interesting stuff — tools, ideas, trends — and share what actually feels useful or worth checking out.

### Leave a Reply [Cancel reply](/easy-way-to-handle-nofollow-sponsored-links-in-ghost-cms-blog/#respond)

## Related Posts

[https://playdevhub.com/seo-for-beginners-adsense/](https://playdevhub.com/seo-for-beginners-adsense/)
 6 May 2026

### [SEO for Beginners: How to Start and Earn With AdSense](https://playdevhub.com/seo-for-beginners-adsense/)

[https://playdevhub.com/seo-authority-backlinks/](https://playdevhub.com/seo-authority-backlinks/)
 6 May 2026

### [SEO Authority Explained: How backlinks strengthen your website](https://playdevhub.com/seo-authority-backlinks/)

[https://playdevhub.com/hybrid-seo-2026/](https://playdevhub.com/hybrid-seo-2026/)
 5 May 2026

### [Hybrid SEO 2026: How AIO, GEO & AEO Transform Search](https://playdevhub.com/hybrid-seo-2026/)

[https://playdevhub.com/seo-audit-checklist/](https://playdevhub.com/seo-audit-checklist/)
 5 May 2026

### [SEO Audit Checklist: 5 Critical Fixes to Recover Lost Traffic](https://playdevhub.com/seo-audit-checklist/)
