docs
/
AI skills

Course with a quiz

Create and save a course in Content Studio, with lesson pages and a multiple-choice quiz whose right answers live in an answer key, then open it.

A course is a post (post) with contentType: "course". Its pages are its lessons. A quiz is one more page whose answers are checked against an answer key. Filling the editor on screen saves nothing: when someone asks for a course, create the record, then open it.

Ask first

Only if it isn't clear from the request:

  • Title and who it's for.
  • How many lessons and what each covers.
  • The quiz: how many questions, and the right answer to each (or write them from the lessons).

Steps

1. Content Studio: save the course

create_record with datatype post:

FieldValue
title, summarythe course
contentTypecourse
pagesthe lessons, then the quiz, in order

A lesson page is { id, title, type: "text", content: "<html>" }. A page can also be video, audio, pdf, form, assignment or download.

A quiz page:

{
  id: "quiz-1",
  title: "Check your knowledge",
  type: "quiz",
  content: "<form data-program-answer> …one radio group per question… <button type=\"submit\">Submit</button></form>",
  answerKey: { "<input name>": { correct: ["<value>"] } }
}

Each question is a radio group (<input type="radio" name="q1" value="b">). The right answers live only in answerKey, never in the HTML, or anyone can read them in the page.

A pass mark is not a field. If one is needed, make the next page open only when the quiz score reaches it (a condition on that page).

Hands on: the post's sk. Check: the returned record has every page, and the quiz page has an answerKey entry for each question.

2. Open it

navigate to /post with { openId: "<sk>" }. The course opens in the editor with its pages listed.

Say "saved" only after create_record returned the record.

Don'ts

  • Don't leave the course as an unsaved draft in the editor (navigate + update_data) when the person asked for a course to exist.
  • Don't put the correct answers in the quiz HTML.