Connect a Ghost blog
One script tag in the code injection – then shortcodes and product links in your posts become product boxes.
Ghost has no server plugins. affilinode therefore comes into your blog through the embed: a script tag that you insert once into Ghost's code injection. After that you write shortcodes as in the WordPress plugin in your posts or simply paste product links – the script turns them into boxes with your website's affiliate links and tracking IDs.
Set up with the assistant
- Open "Integrations" in the menu and click "Set up" next to "Ghost" (or Ctrl+K and "Connect Ghost blog").
- "Blog": enter your blog's address, for example "myblog.com" – for Ghost(Pro) without a domain of your own the address "…ghost.io". The assistant suggests the matching website or creates a new one and sets up the embed key with this domain.
- "Appearance": set what the script should do – "Shortcodes in text", "Convert product links" (product box or compact line, at most per post) and "Matching products for the post". The live preview shows a sample post in Ghost style, optionally with a product of your own.
- "Install": "Copy code", then "Open code injection in Ghost" – the button leads directly to "Settings" → "Code injection". Paste the code into the "Site footer" field and save.
- "Analyze (optional)": In Ghost under "Settings" → "Integrations" → "Add custom integration" create an integration "affilinode", enter the "Content API key" in the assistant and "Create content source". For instant updates, create webhooks in the same integration with the address and secret shown (events "Post published", "Post updated", "Post unpublished", "Post deleted").
- "Check": "Check installation" fetches your blog and looks for the script with your key – on the home page and, if it only appears in posts, in the latest post. Result: found, different key, not found or not reachable.
<script src="https://api.affilinode.com/v1/embed/embed.js" data-key="YOUR-KEY" data-shortcodes="1" data-links="box" data-context-after="3" async></script>
It also works by hand without the assistant: under "Websites" → website → "Embed" enter the domain, "Create key" and under "Generate code" in the "Ghost & forums" tab generate the code.
Generate code
Ghost has no affilinode building block in the editor. That is why the dashboard has the "Generate code" dialog – reachable everywhere via the button in the sidebar or the shortcut Alt + Shift + E, also via "Insert product" on "Integrations" and in the Ghost assistant: choose the box type, search the product or choose list, advisor or product type, set options, look at the preview and copy the shortcode or the HTML card in the "Ghost" tab. Keep the dashboard open in a second tab while writing.
- One product: product box, product card, compact line, price comparison, button, price history, Device + plans, test rating ([affilinode_rating]), At a glance ([affilinode_glance]), Running costs ([affilinode_energy]), Alternatives ([affilinode_alternatives]) and pack sizes ([affilinode_packs]; in the price comparison data-packs="tabs").
- Several products: grid ([affilinode_products]), comparison table ([affilinode_compare]) and ranking ([affilinode_list]).
- Without product selection: product search ([affilinode_search type="…"]), product advisor ([affilinode_advisor id="…"]), compatibility check ([affilinode_compat]), Best in category ([affilinode_top type="…"]) and price-performance chart ([affilinode_scatter type="…" field="…"]).
- In a sentence: text link ([affilinode_link]) and single value ([affilinode_field]).
- Spare parts ([affilinode_spare_parts]), deals ([affilinode_deals type="…" min="15"]) and the comparison picker ([affilinode_compare_picker]) are also available as shortcodes. Only "Matching the content" you set on the script tag.
- Coupons: [affilinode_coupons] (running coupons and promotions; merchant, product, kind, limit) and below a product box or card with coupons="1" – see "Coupons".
[affilinode_top type="smartphone" by="value"]
[affilinode_glance id="asin:B0XXXXXXXX" count="4"]
The battery lasts long, [affilinode_link id="asin:B0XXXXXXXX" text="cheap here" price="1"].
Boxes in the editor
- Shortcode: write [affilinode_product id="asin:B0XXXXXXXX"] in a normal paragraph. If it stands alone in the paragraph, the box replaces the paragraph. There are also [affilinode_offers], [affilinode_button], [affilinode_products ids="a,b"], [affilinode_compare ids="a,b"], [affilinode_list id="…"], [affilinode_price_history], [affilinode_tariffs], [affilinode_spare_parts], [affilinode_deals] and [affilinode_compare_picker] – and all further boxes: [affilinode_search], [affilinode_advisor id="…"], [affilinode_compat], [affilinode_alternatives], [affilinode_top type="…"], [affilinode_glance], [affilinode_scatter type="…" field="…"], [affilinode_energy], [affilinode_rating] and [affilinode_packs]. "Generate code" (see above) builds the finished shortcode – with the same names and attributes as in the WordPress plugin.
- In a sentence: [affilinode_link id="…" text="…"] (text link) and [affilinode_field id="…" field="price"] (price, shop, stars and other single values) stay in their place in the text and look like your text – see "Embed product boxes without WordPress".
- HTML card: if you prefer HTML, insert an HTML card with <div data-affilinode="product" data-id="asin:B0XXXXXXXX"></div> – all displays from "Embed product boxes without WordPress" work this way.
- Product link: paste an Amazon, eBay or Awin link or a link to an offer from your catalog. If the link stands alone in the paragraph, it becomes the box; in the middle of a sentence it stays and the box comes after the paragraph. Links in quotes and code stay unchanged, short links such as amzn.to are not recognized.
As the identifier you use, as in the WordPress plugin, the product's affilinode ID, asin:… or gtin:…. The fastest way is "Generate code": it searches the product and copies the finished shortcode or HTML card.
Newsletter
Ghost also sends posts as email. Email programs run no JavaScript: there a shortcode appears as text in the newsletter, product links stay normal links. For posts you send, therefore use the HTML card and hide it in the email: select the card and in the toolbar switch off the visibility "Email" via the eye. A product link in the text is unproblematic in the newsletter.
Good to know
- The script looks in the post content (for Ghost themes such as Casper and Source in the .gh-content area). If your theme displays the post differently, enter the matching CSS selector in the generator under "Content area".
- Members-only content: Ghost delivers the part behind the paywall only to members. Boxes and matching products arise only from the text the visitor actually sees.
- "Matching products for the post" is included in the Publisher plan. Without that plan this box stays empty; shortcodes and links work anyway.
- Privacy: the script sets no cookies and sends no visitor data – only the link addresses or titles, headings and the start of the post's text. As with any externally loaded script, the visitor's IP address reaches affilinode's server; mention that in your privacy policy.
- Disclosure: every box carries the label "Ad" and an affiliate notice. A note in the post itself does no harm anyway.
- The boxes are created in the browser. Search engines that run no JavaScript, and RSS readers, see the original text or link.
To try it without a key of your own: data-key="demo" works on any domain and shows invented products, for example [affilinode_product id="nw-x5"]. Links go to example.com, there is no commission.