Skip to main content

Personalization Copy Test

This page exercises personalization placeholders inside code blocks. The bug: clicking the copy button puts the un-substituted source (e.g. literal {user.firstName}) on the clipboard instead of the rendered value the user sees on screen. When logged out, user is an empty object — placeholders render as empty strings. When logged in (via JWT) with content.firstName etc. populated, the rendered text shows real values; copy should match. Canary: CANARY-PERSONALIZATION-COPY-01

Plain MDX text (control)

This paragraph references the user variable directly in MDX: hello, ! Your plan is and your API key is . If this paragraph renders the substituted values (or empty strings when logged out), the MDX runtime is wiring up user. If it renders the literal text {user.firstName}, scope is not connecting and the rest of the test won’t diagnose anything useful.

Standalone code block

Hello
echo "Hello {user.firstName}, your plan is {user.plan}"
With API key
curl https://api.example.com/v1/users \
  -H "Authorization: Bearer {user.apiKey}"

Code group (multiple tabs)

curl https://api.example.com/v1/whoami \
  -H "X-User: {user.firstName}" \
  -H "Authorization: Bearer {user.apiKey}"

Verification

The JWT server (jwt-server/server.js) signs tokens with the following content and apiPlaygroundInputs:
  • content.firstName = "Jane"
  • content.company = "Acme Corp"
  • content.plan = "Enterprise"
  • content.apiKey = "sk-test-canary-12345"
  • apiPlaygroundInputs.header.Authorization = "Bearer sk-test-canary-12345"
After restarting jwt-server and logging in via any preset:
  1. The control paragraph should read: “hello, Jane! Your plan is Enterprise and your API key is sk-test-canary-12345.”
  2. Click each copy button under “Standalone code block” and paste. Note whether the clipboard contains literal {user.firstName}/{user.apiKey} or the substituted values that are visible on screen.
  3. If the visible text in the fenced code blocks still reads {user.x} even when authenticated, MDX is not evaluating expressions inside fences and Dean’s bug needs the API Playground path instead (separate setup).