Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

10. Tool purchase options

Date: 2026-11-22

Status

Accepted and implemented by the change that turns a tool’s single product_url into an affiliate collection. Tests are in tests/example_site.rs, unit tests in src/affiliate.rs and src/model/tool.rs, and example tools under examples/basic/tools. The tools format carries the field list and the markup each option earns. This amends the single-link model decided in decision record 7.

Context

Decision record 7 gave a tool one product_url, which the build tagged for Amazon. A maker often buys the same thing from more than one store, and the stores differ in a way worth showing. Amazon ships in days, AliExpress is cheaper but slow. One link can’t express that choice.

AliExpress, unlike Amazon, has no static tracking parameter. AliExpress mints its affiliate link per product through its portals or API, so listsome can’t append a tag the way it does for an Amazon storefront. Any “add AliExpress” design has to accept a pre-minted link for that store while still tagging Amazon URLs, and shouldn’t hard-code one retailer’s scheme into a rule every future store must fit.

Decision

A tool replaces product_url with an ordered affiliate list. Each entry is a store label and a URL:

affiliate:
  - title: Amazon
    url: https://www.amazon.com/dp/B00F2CGXGG
  - title: AliExpress
    url: https://s.click.aliexpress.com/e/<minted>
  • Resolution is per option, keyed by host. An Amazon storefront URL receives the configured [affiliates.amazon] tag. Any other URL, including an AliExpress s.click link, prints exactly as written.
  • Every option is a sponsored link with rel="sponsored nofollow", because an affiliate entry is a referral by intent. Listsome drops the affiliate: false opt-out. A tool that’s only a write-up lists no options.
  • The tool page renders one line, Purchase: followed by each option’s title linked to its resolved URL. The listing links a tool’s title to its own page, not to a store, since there is no longer a single store URL.
  • description no longer collides with a buy link, so it stays optional and falls back to the first body paragraph as before.

The design stays retailer-agnostic. Adding a store that mints its own links, such as AliExpress today and others later, needs no engine change. Listsome tags hosts it knows and prints the rest.

Consequences

  • A breaking frontmatter change. Every existing tool’s product_url becomes an affiliate entry. The example tools and the downstream site migrate in the same change. new-tool scaffolds a one-entry Amazon list.
  • Losing affiliate: false means a tool can’t list a purchase link it doesn’t earn from. That case is rare, and the tool lists no option instead.
  • Listsome drops the per-tool “direct link” affordance. The Purchase: line replaces it. Templates and snapshots change with it.