Making a quiz by hand
You need nothing but a text editor and this guide. A quiz lives at content/quizzes/<slug>.json, so:
- Pick a slug — lowercase kebab-case, e.g.
coffee-order-personality. Createcontent/quizzes/coffee-order-personality.json. - Write the header —
slug(same as filename),title,description,enabled: falsewhile you work. - List the results first. It is much easier to write questions when you
know the possible outcomes. Give each result a short id (
latte,espresso) and a fun description. - Write 4–8 questions. Each question has an id (
q1,q2…), text, and 2–10 options. Convention: option ids are<question-id>-a,-b,-c… - Wire the scoring. Each option’s
scoresobject maps result ids to points. Simple approach: give the matching result1point. Spicier approach: spread points, e.g.{ "latte": 2, "espresso": 1 }. - Validate. Either paste the JSON into the admin editor (it validates as
you type) or run
npm run check/ open/quiz/<slug>while logged out — broken quizzes show a warning page instead of a quiz. - Enable it. Flip
enabledtotrue(or use the toggle in the admin dashboard, which refuses to enable a quiz that fails validation).
Tips
- Put every result’s id into at least a few options’
scores, otherwise that outcome can never win (the validator warns you). - One point per matching option is fine; the tally just needs a winner.
- Keep option text short — it reads better on phones.
- Test every path by clicking through your own quiz once before enabling.