Connect a Discourse forum
With the theme component, product links in forum posts become product boxes, and every topic shows matching products.
For forums running Discourse there is a theme component. It uses the embed: supported product links in posts (Amazon, eBay, Awin deep links and shop pages that affilinode knows as an offer) show a product box with your website's affiliate links, shortcodes such as [affilinode_product id=…] become a box, and if you like every topic shows matching products from your catalog once.
Set up with the assistant
- Open "Integrations" in the menu and click "Set up" next to "Discourse" (or Ctrl+K and "Connect Discourse forum").
- "Forum": enter the forum's address, for example forum.example.com. The assistant assigns it to a website (or creates one) and sets up the embed key with this domain.
- "Component": "Install in Discourse" opens the "Install" dialog in your forum with the component's address already entered. Confirm and add the component to the forum's themes ("Add to themes"). If the direct link does not work, paste the repo address shown under Admin → Customize → Themes → Install → "From a git repository".
- "Settings": choose what the component should do. The table shows the values to copy; only affilinode_key is required, everything that differs from the default is marked.
- "Analyze (optional)": "Create content source" (API key only for non-public categories) and in Discourse under Admin → API → Webhooks create a webhook with the address and secret shown – content type application/json, events Topics and Posts.
- "Check": "Check installation" reads from the forum's home page whether the component is set up in the active theme with your key. If the forum can only be read after signing in, write a test post with an Amazon link – after that the check shows under "Last fetched" and "Visible boxes" whether the boxes arrive.
It is a theme component, not a plugin: it can be installed without a restart, even on hosted forums. Discourse 3.4 or newer is required.
Settings
- links_mode: box (product box), compact (line) or off; links_max_per_post limits the boxes from links per post (default 3).
- shortcodes: show shortcodes as boxes – all boxes of the WordPress plugin, from [affilinode_product] to [affilinode_search], [affilinode_advisor], [affilinode_compat], [affilinode_top], [affilinode_scatter], [affilinode_energy] and [affilinode_rating] (attributes as in the plugin, see "Embed product boxes without WordPress"). The composer menu then has "Insert product": it searches your catalog and inserts the shortcode. From version 0.3.0 of the component, "More boxes …" lists all box types – product card, test rating, At a glance, Follow-up costs, Alternatives, text link and single value in a sentence, ranking, product search, product advisor, compatibility check, Best in category and the price-performance chart; from 0.5.0 also "Coupons" ([affilinode_coupons]) and, for product box and card, "Merchant coupons below" (coupons=1). You update the component in Discourse under Admin → Customize → Themes → Component → "Update".
- All options of a box: in the dashboard open the "Generate code" dialog (sidebar, Alt + Shift + E or under "Integrations" → "Insert product", also at the end of the Discourse assistant), put the box together and copy the shortcode in the "Discourse" tab.
- context_enabled: matching products once per topic, after the post from context_after_post (default: after the first), with context_limit products and a heading of your own in context_title.
- excluded_categories: categories without boxes, for example Off-topic – subcategories are excluded too.
- min_trust_level_for_links: convert links only in posts from this trust level up, as protection against spam. Posts by the team are always converted, shortcodes work regardless.
- theme and accent: look of the boxes as with data-theme and data-accent.
If a link stands alone in its paragraph (bare address or preview card), the box replaces the paragraph; otherwise it comes after the paragraph and the link stays. Private messages, hidden posts, the composer preview and links in quotes and code are not converted. Short links such as amzn.to are not resolved.
Privacy and disclosure
- For links only the link addresses are sent, for matching products title, category, tags and the beginning of the first posts (at most 2,000 characters) – no usernames, no visitor data, no cookies. affilinode stores neither links nor texts.
- The boxes carry the label "Ad" and the affiliate notice themselves.
- "Matching the topic" is included in the Publisher plan; in other plans the box stays empty. Every call counts towards the API quota.
The boxes are created in visitors' browsers. Search engines and email notifications only see the original post with the link. If the boxes stay empty, the forum's domain is usually not approved – it then appears at the key under "Rejected domains (30 days)".