Skip to content

Adding a subject or course

Register a new subject or course in the content manifests, and what appears in the app when you do.

Subjects and courses are plain JSON files in content/. Adding one needs no code changes: the build reads the manifests and the app shows a course as soon as it has its first note.

How the manifests fit together#

content/subjects.json          -> subjects, in display order
  courses: ["physics-as", ...]  -> content/courses/physics-as.json
    units[].notes: ["kinematics/equations-of-motion", ...]
                                -> content/notes/physics-as/kinematics/equations-of-motion.md

Adding a course#

  1. Create content/courses/<slug>.json:

    {
      "slug": "further-pure-1",
      "subject": "maths",
      "title": "Further Pure Mathematics 1",
      "short": "FP1",
      "level": "AS",
      "paper": "FP1",
      "units": [
        {
          "slug": "roots-of-polynomials",
          "title": "Roots of polynomial equations",
          "notes": ["roots-of-polynomials/symmetric-functions"]
        }
      ]
    }
  2. Add the slug to its subject's courses list in content/subjects.json, in the order courses should appear.

  3. Write the notes under content/notes/<slug>/, with course: <slug> in their frontmatter.

  4. Run pnpm notes:check <slug>.

FieldMeaning
slugLowercase letters, digits and hyphens. Must match the file name and the notes folder.
subjectThe subject's slug
titleFull course name, shown in the sidebar and on the home page
shortShort label shown in search results, on the home page, in the planner and on cheat sheet items, such as P1 or AS
levelAS or A2
paperThe paper label for the course
unitsUnits in syllabus order, each with a slug, a title and its note ids

Note ids in units[].notes are relative to the course folder. The sidebar lists units in manifest order, each with its notes. A unit with the slug overview is left out of the unit counts on the home page, so put it first.

Adding a subject#

Add an entry to content/subjects.json:

{
  "slug": "further-maths",
  "title": "Further Mathematics",
  "short": "Further Maths",
  "code": "9231",
  "syllabus": "Cambridge International AS & A Level Further Mathematics (9231)",
  "courses": ["further-pure-1"]
}
FieldMeaning
slugThe subject's id, used by its courses' subject field
titleFull name
shortShort name for tight spaces
codeThe syllabus code
syllabusThe syllabus's full title
coursesCourse slugs in display order

Then add its courses as above.

When it appears#

The build only exposes courses that have at least one note, and subjects with at least one such course. So you can commit a complete manifest for a subject before its notes are written: it stays hidden in the workspace until the first note lands, and then the course appears in the sidebar, the planner and search together.

pnpm notes:check warns when a manifest references a note file that does not exist yet, which doubles as a to-do list while a course is being written.

Things to check by hand#

  • Subject icon. Each subject has a lucide icon, set in SUBJECT_ICONS in src/components/meta.tsx. A new subject shows a plain book icon until you add one.
  • AI prompts. The AI features are switched off for now (AI_ENABLED in src/config/ai.ts), but their prompts in src/server/ai/prompts.server.ts are written per subject. Add the new subject's conventions there so the prompts are ready when AI returns.
  • Syllabus coverage. The manifest must cover every learning outcome in the current syllabus, in syllabus order. See Writing notes.

Search documentation

Search every page of the Margin docs