Gift Links for Ghost
Let members share paywalled posts with anyone.
Adds a "Gift this article" button to your Ghost site that appears on articles that require paid access. Paying members click the button and get a special gift link they can share. Anyone who visits that gift link can read the full post without an account (until the links expire)
Setup
- In Ghost Admin, go to Members and create a new member with the email bot@giftlinks.net. Give it a complimentary subscription to a paid tier.
- Enter your Ghost site URL below and click Connect. This sends the bot the sign-in email it needs to read your paywalled posts.
- Configure your gift link settings (both optional):
Leave blank for defaults (14-day expiry, no view limit). "0" means unlimited.
If you use a custom theme you may also need to set up selectors. See Gift Links Configuration. - In Ghost Admin, go to Settings → Code injection and paste this in the Site footer:
<script src="https://giftlinks.net/client.js" defer></script>
How it works
A small script on your site adds a "Gift this article" button to paywalled posts for paying members.
A member of your site clicks this button.?gift=xxxxx on the end.Features
- Uses normal links. Gift links are regular links to a post on your site. They just have an extra code on the end. Link previews, analytics, etc should all work as usual.
- Multi-use links. A gift link can be shared with multiple people. One link, share it anywhere for 14 days.
- Nothing stored on your Ghost server. The client script, tokens, and bot session all live on Cloudflare. Uninstall by removing one line of code injection.
- Trustless. Does not require Admin API.
FAQ
What does it cost? The service is free. It's very inexpensive to host. Maybe there will be a Pro version some day, but the basic app will stay free.
Is the source code available? Not yet. Soon!
Does the bot have admin access? No. The bot is a regular comped member. It can only read content a paid subscriber would see.
What happens when a gift link expires? The visitor sees the normal paywalled post with a message the gift link is expired. Nothing breaks.
Can a gift link be shared with multiple people? Yes. The link will work without limits until it expires or the max views limit is hit.
How do I uninstall? Remove the code injection line and delete the bot member from Ghost Admin.
Are you doing something sneaky with my content/data? No. See the privacy policy.
More questions? Email me eli@elidickinson.com or find me on Bluesky @eli.pizza
Gift Links Configuration
Add these attributes to the script tag to configure gift link behavior. All are optional; the script guesses sensible defaults for standard Ghost themes.
| Attribute | Description |
|---|---|
data-gl4g-ttl-days | How many days each gift link stays active. Without it, links expire after 14 days. |
data-gl4g-max-views | Limit how many times each gift link can be viewed. Without it, links are unlimited until they expire. |
data-gl4g-content | CSS selector for the post content container. By default the script tries: .gh-content, .post-content, .post__content, .post-body, article.post, article, .content. You will need to set a selector here if those don't work for your theme. |
data-gl4g-gate | CSS selector for the paywall element. If this element is on the page then the post is currently paywalled and the visitor doesn't have access. By default the script tries: .gh-post-upgrade-cta, .gh-cta, .single-cta, .content-cta, .post-sneak-peek. The selector should only match at most one element on the page. |
data-gl4g-bar | By default the script adds a message bar at the top of the post if it needs to say something about gift links. You can set a selector here and it will use that spot instead (replacing anything currently inside it) |
data-gl4g-api | Custom worker URL if you are self-hosting instead of using giftlinks.net (default: https://giftlinks.net). |
<script src="https://giftlinks.net/client.js" defer data-gl4g-ttl-days="7" data-gl4g-max-views="10" data-gl4g-content="article.post"> </script>
Customize wording
Override any user-facing string by setting window.gl4g_strings in Ghost Code Injection before the client script:
<script>
window.gl4g_strings = {
button_text: 'Share this post',
gift_banner: 'This article was shared with you by {name}.',
};
</script>
<script src="https://giftlinks.net/client.js" defer></script>
| Key | Default |
|---|---|
button_text | Gift this article |
creating_text | Creating link… |
loading_text | Loading gifted article… |
expired_text | This gift link has expired. |
limit_text | This gift link has reached its view limit. |
error_text | There was a problem loading your gift link. Reload the page to try again. |
created_text | Gift link created! Copy it below… |
gift_banner | You’re accessing a gift link. Subscribe… (HTML ok, {name} placeholder) |
copy_text | Copy |
copied_text | Copied! |
Set any string to an empty value ('') to hide that element entirely.
Customize button placement
By default, the gift button is a floating element in the bottom-left corner. Place your own button anywhere in your theme using gl4g-button — the script will find it and attach the click handler.
If your theme has access to @member.paid, Ghost handles visibility for you:
{{#if @member.paid}}
<a href="#" class="gl4g-button gh-btn">Gift this article</a>
{{/if}}
If your button is always in the HTML (e.g. in Code Injection, which doesn’t support Handlebars), wrap it so it stays hidden until the script activates it:
<div class="gl4g-button-wrapper" style="display:none"> <a href="#" class="gl4g-button gh-btn">Gift this article</a> </div>
The script only looks for .gl4g-button. You control the element type, text, and styling. If a .gl4g-button-wrapper parent exists, the script unhides it when the button is activated.
CSS: To customize styles, target the .gl4g- prefixed classes in Code Injection. For example, use .gh-content .gl4g-bar for the banner and .gl4g-button for the gift button.