Skip to content

feat: add /bitget and /binance affiliate redirects with og cards#34

Merged
ronload merged 1 commit into
mainfrom
feat/affiliate-redirects
Apr 29, 2026
Merged

feat: add /bitget and /binance affiliate redirects with og cards#34
ronload merged 1 commit into
mainfrom
feat/affiliate-redirects

Conversation

@ronload
Copy link
Copy Markdown
Owner

@ronload ronload commented Apr 29, 2026

Why

We want to publish short URLs kaiyn.org/bitget and kaiyn.org/binance
that funnel into our affiliate links, but a plain HTTP redirect would
let social crawlers fall through to the destination — shared previews
on Twitter / Discord / LINE / Slack would show Bitget or Binance
branding instead of kaiyn's. We need real HTML at those paths so the
preview cards stay on-brand, while still sending humans straight to
the affiliate destination so the ref code attaches correctly.

How

/bitget and /binance are Route Handlers that branch on User-Agent:

  • Crawlers (facebookexternalhit, Twitterbot, Slackbot,
    Discordbot, LINE, WhatsApp, etc.) get a 200 with a minimal HTML
    document containing OG and Twitter Card meta pointing at static
    1200×630 images in public/og/.
  • Humans get a 307 straight to the affiliate URL — no visible flash,
    ref code preserved.

Both paths are excluded from the next-intl middleware matcher so they
keep their naked URLs instead of being rewritten to /en/bitget. Pages
are marked noindex,follow so they stay out of search results while
remaining crawlable for OG fetchers (most ignore robots.txt anyway).

A Route Handler was preferred over a page under [locale]/ because OG
copy is a single English version and we don't want the locale prefix in
the canonical URL. It's also lighter than introducing parallel root
layouts via route groups.

Test plan

  • Browser UA → /bitget returns 307 with Location: https://partner.bitget.site/bg/JZQT5S
  • Browser UA → /binance returns 307 with Location: https://www.binance.com/join?ref=148898758
  • Twitterbot/1.0/bitget returns 200 text/html with full og:* and twitter:* meta
  • facebookexternalhit/1.1/binance returns 200 with OG meta
  • /og/bitget.png and /og/binance.png serve 200
  • pnpm build passes; /bitget and /binance register as dynamic routes
  • Post-deploy: validate via Twitter Card Validator, Facebook Sharing Debugger, LinkedIn Post Inspector
  • Post-deploy: click links on a real device and confirm ref code attaches in destination URL

Pure HTTP redirects let social crawlers fall through to the affiliate
destination, so shared previews would show Bitget or Binance branding
instead of kaiyn's. Serve a real route that branches on User-Agent: bots
get an HTML page with OG and Twitter Card meta tags pointing at static
1200x630 images, humans get a 307 straight to the affiliate URL with no
visible flash.

Both paths are excluded from the next-intl matcher so they keep their
naked URLs instead of being rewritten to /en/bitget. Pages are marked
noindex so they stay out of search results while remaining crawlable
for OG fetchers (most ignore robots.txt anyway).
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
kaiyn-website Ready Ready Preview, Comment Apr 29, 2026 2:16pm

@ronload ronload merged commit c01e2d7 into main Apr 29, 2026
6 checks passed
@ronload ronload deleted the feat/affiliate-redirects branch April 29, 2026 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant