Skip to content
DocsFor version 1.1.x

Placements and sponsorships

Featured spots are their own records, not a field on the listing, so each has dates and a place. Each record is a file in src/content/directory/placements/, named <listing>--<slot>--<start>.json, and the CMS edits each one as an entry:

{ "listing": "acme-books", "slot": "category:finance", "label": "editors-pick", "start": "2026-11-01", "end": "2026-12-31" }
  • slot: home (the homepage), category:<slug> (a category page; the listing must be in the category) or, for sponsors only, category-sponsor:<slug> (a category’s “Sponsored by” line). Editor’s picks show in the homepage’s featured section (up to 5) and the category’s featured block (up to 2), the newest start first.
  • label: editors-pick (chosen by the editors, never paid for: the featured sections) or sponsored (paid: see “Sponsored placements” below). A sponsored record needs an end.
  • start and end (YYYY-MM-DD): a placement shows from its start through its end date, both days included; with no end it shows until you remove it. note is for you and never shown.
  • Dates are in UTC, and change when the site rebuilds. “Today” is the build’s UTC date, and the daily rebuild runs at 05:17 UTC (about 05:20 once it’s deployed). So a placement starting on the 1st goes up at about 05:20 UTC on the 1st, which is still the evening of the 31st in the Americas and the afternoon of the 1st in East Asia. It comes down at the same time on the day after its end. To move the change, edit the cron line in .github/workflows/daily-rebuild.yml. Sponsors see the same rule on the Advertise page.
  • order (optional): to choose a slot’s order, give its records order numbers. The lowest shows first, ahead of any record without one.

A listing with any Editor’s pick showing gets the “Editor’s pick” chip and sorts first under “Editor’s picks first”. Every build logs what’s showing and what ends within 7 days, and DIRECTORY_TODAY=2026-12-01 npm run build previews another day. The build checks every record’s dates. A record whose listing or category no longer exists (deleted or renamed in the CMS), or whose listing has left the category, is left out with a warning in the build log, rather than stopping the build, which would also stop the daily rebuild and leave every other placement up past its end. Fix or delete the record when you see the warning. Before deleting a listing, delete or move its placements.

Placements start and end only when the site is rebuilt, so turn on the daily rebuild. Coming from an older copy of the starter with featured: true in listing files? npm run placements:migrate moves them into placements (dry run first, then -- --yes). With the old single file, src/content/directory/placements.json, the build warns, and npm run placements:split moves each record into its own file: dry run first, then -- --yes. A slot’s old order is kept, as order numbers where it differs from newest first.

A sponsored record is a paid place, kept apart from everything editorial:

  • home: the sponsored spots at the foot of the homepage’s categories section;
  • category:<slug>: the sponsored spots at the top of that category’s page, before its Editor’s picks and its list;
  • category-sponsor:<slug>: a “Sponsored by {name}” line in the category’s header (one sponsor).

Each says Sponsored in its own neutral style (never the Editor’s pick style), linked to the review page’s definition, with one line saying it’s paid (labels.badges.sponsored_note). Its links to the sponsor’s website carry rel="sponsored noopener", open in a new tab and never get ?ref=. A sponsored record never makes a listing “featured” and doesn’t change its place in any list. Check the wording against the advertising-disclosure rules where you operate.

Several sponsors in one place. A place shows as many sponsors at once as its package’s slots (the most, if two packages sell it; every one running, for a place no package sells), side by side, each card labelled Sponsored; on phones they’re a row to swipe through, like the Editor’s picks. They take turns at the front, a day each, so no sponsor always leads (takeTurns in src/lib/directory/placements.ts: ordered by start date, then listing, and rotated by the day’s number). A category’s “Sponsored by” line names one sponsor whatever the package says. The build warns when a place has more booked than it holds (see the Advertise page below).

The Advertise page: selling sponsored places

Section titled “The Advertise page: selling sponsored places”

/advertise (routes.advertise; off with advertise.enabled) shows the packages you sell, the rules for paid places, how buying works and an FAQ (copy: pages/advertise.json). Each package is in directory.config.json → advertise.packages:

{
"id": "category-spot",
"name": "Sponsored listing in a category",
"description": "Your listing at the top of one category page, labelled Sponsored.",
"includes": ["One category of your choice", "A direct link to your website", "Shown for 30 days"],
"price": 149,
"durationDays": 30,
"slot": "category",
"slots": 1,
"paymentUrl": "https://buy.stripe.com/…"
}
  • slot: what it sells. home, category and category-sponsor are places on the site (a placement record per sale, with "package": "<id>"); newsletter and fast-track are services, with no place on the site.
  • slots: how many sponsors that place shows at once, side by side (per category for the category slots; in the editor, the package’s Advanced → Spots available). New sites start with 3 for home and 2 for category; category-sponsor is always 1. The card says when it’s free, from the sponsored records, and the booking form how many spots are free for the dates chosen.
  • highlight (optional, true on one package at most): marks it “Most popular” (pages/advertise.json → card.popular), with an accent ring. Every other card looks the same.
  • price (in advertise.currency, shown in locale.format) and durationDays (needed for the places on the site).
  • paymentUrl: a payment link (for example a Stripe Payment Link). The button opens it in a new tab with ?client_reference_id=<package id>, so the payment says which package it was. Empty: the card says Contact us and opens the contact form with the package named, so the page works before payments are set up.

Setting it up

  1. Write your packages and prices in advertise.packages (replace the demo ones), and set advertise.currency.

  2. At your payment provider, create a payment link for each package, and paste it into paymentUrl. Set the link’s confirmation page (Stripe: After payment → Don’t show confirmation page → Redirect) to https://<your domain>/advertise/thanks?package=<package id>. That page thanks the buyer and sends them to the contact form with the package named, to send their listing, category and start date.

  3. For each sale, add a placement record, with the package’s id and the dates. In the CMS, that’s a new entry under Placements. By hand, it’s a file in src/content/directory/placements/:

    { "listing": "acme-books", "slot": "category:finance", "label": "sponsored", "start": "2026-12-01", "end": "2026-12-30", "package": "category-spot" }

    Use category:<slug> for a sponsored listing in a category, home for the homepage spot and category-sponsor:<slug> for a category sponsor.

  4. Turn on the daily rebuild, so each placement starts and ends on its dates.

  5. Rewrite the page’s rules and FAQ for your own terms (refunds, what you’ll refuse), and check them, and the Sponsored label, against the advertising-disclosure rules where you operate.

Every build logs the places showing and any starting or ending within 7 days, and warns when a place is overbooked (more sponsored records running at the same time than its package’s slots; the one that shows is the one with the lowest order, then the newest start) and when a record’s package doesn’t exist or sells another kind of place. The daily rebuild’s Wrangler option copies these lines into its run’s summary. To take payment and book the place in one go instead, see the next section.

Selling sponsored places automatically (Stripe Checkout)

Section titled “Selling sponsored places automatically (Stripe Checkout)”

The short version: Sponsorship payments, or npm run setup.

With advertise.checkout.provider set to "stripe", a sponsor books and pays on the Advertise page, and the placement record writes itself:

  1. Booking. Each package’s button opens a booking form: the package, their listing (any published listing that isn’t a demo), its category for a category package, and a start date. The first free date is filled in, and the form says how many spots are free for those dates; when the place is full, it gives the next free start, with a button to take it. A listing’s page links to the same form with the listing chosen (“Own {name}? Upgrade this listing”, pages/advertise.json → booking.upgrade_lead and upgrade_link), while the checkout is on and a package sells a place, and never on a demo listing.
  2. The checkout. The form posts to /api/advertise/checkout (the site’s Worker, beside /api/submit):
    • The details are checked: the listing is real and published, the category is its own, and the start is between leadDays and maxAdvanceDays from today.
    • The place must be free: not booked in the placements, in a sponsorship pull request not yet built, or by someone else’s open checkout.
    • The place is held, and the sponsor goes to Stripe’s own checkout page. The price, the dates and the place come from your config, never from the browser.
    • The hold lapses if they don’t pay: Stripe’s checkout closes after holdMinutes (30 by default), and the hold stays 10 minutes longer, so a payment made in the last minute still finds its place.
  3. The webhook. Once they’ve paid, Stripe calls /api/advertise/webhook:
    • It checks the place again (it may have been taken meanwhile).
    • It writes the placement record as a pull request on cms/placements/<listing>--<slot>--<start>, labelled sponsorship. With the CMS reviewing placements, it’s also labelled for the CMS’s board.
    • It emails you through the contact form’s service (forms.contact): the payer’s email, the amount, and links to the payment in Stripe and the pull request. The payer’s details are never in the repository. That service must be Formspree, Web3Forms or a custom endpoint, and connected: Netlify Forms can’t be sent to from a function. The build warns otherwise, because a payment waiting for your approval would go unnoticed (the daily rebuild’s warning a day before its start would be the first you heard of it). A form service’s spam filter can keep this email (Formspree emails only what reaches its inbox), so look in its spam folder the first time; the editor’s Site status lists paid bookings waiting either way.
  4. Approval (advertise.checkout.approval):
    • "owner" (the default): the pull request waits for you. Check the listing and the sponsor, then merge it (or Publish it in the CMS: the Editorial Workflow board → In Review → open it → Publish; with One-click publishing off, set its Status to Ready first) before its start date. To turn a sponsor down, refund them in Stripe: the pull request closes by itself (closing it alone doesn’t refund them). The daily rebuild warns about any waiting within a day of their start.
    • "auto": it’s merged at once, and goes live on its start date. That needs the pipeline’s GitHub App to be able to merge, so either the ruleset requires no approval, or the App is on its bypass list for pull requests. A leaked key could then publish anything, not only placements, so choose it only if you accept unreviewed paid placements.
  5. It starts and ends on its dates, as every placement does (the daily rebuild): at about 05:20 UTC on its first day, and the same time the day after its last. The booking form’s dates, leadDays and maxAdvanceDays are in UTC too, and the Advertise page’s rules say so.

What happens when…

  • The place was taken by the time the payment arrives. For example, you booked it by hand in the CMS while they were paying. They’re refunded in full, automatically, and you’re told. Offer them another date if you can.
  • A card is declined. The checkout never completes, and the hold lapses with it.
  • The payment clears later (bank debits, with paymentMethods: "any"). The place is held for asyncHoldDays (3) until it clears, then booked; if it fails, the hold goes and you’re told. The default, "instant", takes cards and wallets only.
  • You refund in full in the Stripe Dashboard. Before it’s merged, its pull request closes. Once live, a pull request ends it yesterday (or removes it, if it hadn’t started); in "auto" that’s merged too. A partial refund only tells you.
  • A dispute. You’re told. With onDispute: "end", it also ends as a refund does.
  • Stripe sends an event twice. Nothing happens twice: each step finds what it already did by the payment’s Checkout Session. Events already handled are also remembered for a week, so you aren’t emailed twice. Across Worker instances, that needs the RATE_LIMIT KV namespace. If GitHub or Stripe is down, the webhook answers with an error and Stripe tries again later.
  • The amount paid isn’t the package’s price. The checkout always sets the price from your config, so this only happens with a Checkout Session made some other way on your Stripe account (by hand, or by another app) that carries this directory’s details. Nothing is booked, and you’re emailed to check it. A package with its own stripePrice isn’t checked, because its amount is set in Stripe.

Services (the newsletter and fast-track packages) have no place on the site. They’re paid the same way, and the webhook only emails you.

Sponsoring with a submission (advertise.checkout.withSubmission, on by default; in the editor, Settings → Sponsorships → Advanced → Sponsor while submitting). The Advertise page’s booking form has a Not listed yet? callout beside it, linking to /submit/?sponsor=<package>. The submit form offers Make it sponsored (optional) from the start (SponsorFields, copy in pages/submit.json → form.sponsor): a place, its category among those ticked above, and a target start no sooner than submissionLeadDays, the first free date filled in from availability.json. Its fields belong to a form of their own, so nothing of the booking reaches the submission. Once the submission is in, its pass and the choice go to the same checkout as the Advertise page’s, with the booking’s own robot check, then Stripe. If the place can’t be booked, the listing is still sent and the thank-you page’s offer (SponsorOffer, copy in pages/advertise.json → booking.offer_*) says why; a visitor who chose no place isn’t asked again. The listing isn’t on the site yet, so:

  • A pass names it. The submission function’s answer carries a pass for the listing (src/lib/advertise/pending.ts): its slug, name, categories and branch, good for a day, signed with a key made from STRIPE_SECRET_KEY and never sent anywhere else. The browser keeps it for that tab only (sessionStorage), so the offer shows only there. Nothing personal is in it.
  • The checkout accepts a pass only for its own listing, and only while that listing’s pull request is still open (not published, not declined). Its earliest start is submissionLeadDays (7) after today, so you have time to review.
  • The webhook puts the placement record onto the listing’s own pull request, with a review note at the top of the listing saying which place, the dates and the day to publish by, and a marker in the pull request’s text. It’s never merged by itself: publishing the listing puts both live.
  • Declining it: refund the payment in Stripe. The refund takes the placement and its review note back off the pull request, and leaves the listing for your review.
  • On the board: the editor reads the open sponsorship pull requests and their marker, and badges the matching card (matched by its pull request’s branch, never by name): “Sponsored · Homepage, from 3 Dec · approve by 2 Dec”. The listing’s own card says “A submission with a paid sponsorship”, with the day to publish by.
  • Reminders in the editor: one note in the editor’s corner for the paid bookings waiting, “A paid booking is waiting for your approval” (or how many), naming the first to approve and its day (the day before it starts), warned two days before; not shown on the board or on the listing it’s about, whose cards say it. Site status’s Paid bookings row lists each, with what to do. They’re read from the pull requests, since the site’s GitHub App can’t read issues. A listing declined (closed without being published) in the last 30 days whose sponsorship hasn’t been refunded is shown as an error until it is.

Setting it up (a sandbox or Test mode first)

The site needs two values from Stripe, which do different jobs: a restricted key (STRIPE_SECRET_KEY), with which the site starts checkouts and refunds, and nothing else; and the webhook’s signing secret (STRIPE_WEBHOOK_SECRET), with which it checks that each event really came from Stripe.

  1. In Stripe, in a sandbox or Test mode (an account offers one or the other; Stripe’s help on sandboxes):

    • A restricted key (Stripe’s help), under Restricted keys, not Standard keys, with exactly these four permissions and everything else None (STRIPE_PERMISSIONS in src/lib/cms/stripe-permissions.ts):

      • Checkout Sessions: Write (to start a checkout when a sponsor books);
      • Refunds: Write (to refund a booking you turn down);
      • PaymentIntents: Read (to match a payment to its booking);
      • Charges: Read (to see a refund or a dispute).
    • A webhook for your account’s events (Stripe’s help), of type Webhook endpoint, at https://<your site>/api/advertise/webhook, with the Snapshot payload if Stripe asks (the webhook reads each event’s data.object, which thin events don’t carry), listening to these events:

      • checkout.session.completed;
      • checkout.session.async_payment_succeeded and checkout.session.async_payment_failed;
      • checkout.session.expired;
      • charge.refunded;
      • charge.dispute.created.

      Copy its signing secret (whsec_…).

  2. On your host: set STRIPE_SECRET_KEY (the restricted key, rk_test_…) and STRIPE_WEBHOOK_SECRET, each as a Secret: npx wrangler secret put STRIPE_SECRET_KEY, and the same for the secret. In Cloudflare’s dashboard, never add them as plain Text, and never copy a key into wrangler.jsonc, which is in your repository. Your account’s full secret key (sk_…) would work but can do anything in your Stripe account: use the restricted key. The webhook writes through the submission pipeline’s GitHub App (the pipeline’s step 2), so set that up too, even if you don’t take submissions. Add a sponsorship label to the repository.

    • Check the key: signed in to the editor, Set up your site → Sponsorship payments (/admin/setup.html#sponsorships) → I’ve added them: check for me. The site (/api/cms/status, editors only; stripeCheck in src/lib/cms/key-status.ts) sends Stripe one harmless request per permission (two reads of one record, and two writes with nothing in them, which Stripe refuses before anything is made): a 403 names the missing permission, and the answer says whether the key is a test or a live one, and whether it’s restricted. A missing permission is fixed by editing the key in Stripe: no new key needed. The signing secret can only be checked when Stripe sends an event.
  3. In directory.config.json → advertise.checkout: set provider to "stripe", and check approval, leadDays (time for you to approve) and holdMinutes.

    • Prices: each package’s price (in advertise.currency) is charged as it is.
    • Stripe Prices: to use your own instead, with their tax settings, give the package a stripePrice (price_…).
    • Tax: automaticTax: true turns on Stripe Tax, once it’s set up in Stripe.
  4. The copy: rewrite the Advertise page’s rules and refund terms, which the booking form links to. The form’s words and messages are in pages/advertise.json → booking, “How it works” for the online flow in how_online, and the thanks page’s in pages/advertise_thanks.json → online (its record line shows the booking’s package and reference, {package} and {reference}, read from the address Stripe sends the sponsor back to). Each has a default, so you only add the ones you rewrite.

  5. Receipts: Stripe emails receipts for live payments only, and only once they’re turned on for successful payments (Stripe’s help on receipts). The thanks page doesn’t promise one.

  6. A test purchase, with Stripe’s test card 4242 4242 4242 4242:

    • the pull request appears, and so does your email;
    • merging it shows the placement on its start date;
    • a full refund in the Dashboard closes or ends it.

    Then switch both secrets to live ones (a live restricted key, and a live-mode webhook endpoint’s secret).

Security

  • The webhook: every call is verified against STRIPE_WEBHOOK_SECRET: the raw body, the Stripe-Signature, and a 5-minute window, so an old call can’t be replayed. Only your own checkouts, in the key’s own mode, are acted on.
  • The key: it’s restricted to the four permissions above, and secrets are only in the host’s environment, as secrets: never in wrangler.jsonc or anywhere else in the repository.
  • Card details never reach the site: Stripe’s page takes the payment.
  • Holds and the lock: open checkouts hold their place as git refs (refs/holds/…), and a short lock (refs/locks/advertise) stops two checkouts taking the last place at once. Refs outside refs/heads start no build and don’t show on GitHub.
  • Holding every place: a script that opens checkout after checkout could keep places held. Three things stop it:
    • One open checkout per visitor. It’s read from the holds themselves (each names a keyed hash of the visitor’s address, never the address), so it works on every instance, with or without a KV store.
    • An hourly limit (perIpPerHour). It needs the RATE_LIMIT KV namespace to count across instances (the pipeline’s step 5); without one, the checkout logs it.
    • Turnstile. Set it up (the pipeline’s step 3; the checkout uses the same site key). The build warns while the checkout is on without it.
  • The visitor’s address comes only from the header your host sets and a visitor can’t: cf-connecting-ip on Cloudflare, or the one the Netlify and Vercel adapters name in CLIENT_IP_HEADER. A made-up X-Forwarded-For changes nothing. A request with no address shares one count with every other such request.

Testing:

  • npm run qa:advertise: the checkout and the webhook, with Stripe and GitHub mocked.
  • npm run advertise:e2e: a real run in Stripe’s test mode, against a GitHub test repository (For developers in the submission pipeline).
  • npm run stripe:check-permissions: confirms, in a sandbox or Test mode, what the permission check relies on: that Stripe refuses a key without a permission (403) before it reads the empty request (400). Run it once with a restricted test key whose permissions are all None (each line should say 403), then with one that has the four. The key is read from STRIPE_CHECK_KEY, typed into a hidden prompt (read -rs STRIPE_CHECK_KEY && export STRIPE_CHECK_KEY && npm run stripe:check-permissions; unset STRIPE_CHECK_KEY); it refuses a live key.

These docs describe SixtyList 1.1.x.