-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
educationfeaturephase-2-enhancementJanuary 2025 student workJanuary 2025 student workpriority: highImportant for Phase 2Important for Phase 2student-readyReady for student to pick upReady for student to pick upteam: internalWork being handled by internal student developersWork being handled by internal student developers
Milestone
Description
Goal
Set up Astro content collections to store each lesson as an individual JSON file (singleton pattern).
Context
See full migration plan: .github/MIGRATION_TO_KEYSTATIC.md
Currently lessons are fetched from Google Sheets. We're migrating to Git-based content with one file per lesson.
Tasks
- Create
src/content/directory - Create
src/content/config.tswith lesson schema - Define Zod schema for lesson validation (name, slug, description, url, etc.)
- Configure content collection type as 'data' (JSON files)
- Create placeholder lesson files for testing (2-3 examples)
- Test content collection queries work
- Update TypeScript types in
src/types/lesson.tsto match schema - Document content collection structure in STUDENT_README.md
Content Structure
src/content/
├── config.ts # Schema definition
└── lessons/ # One file per lesson
├── building-community.json
├── leadership-governance.json
└── ... (56 total after migration)
Example Schema
import { defineCollection, z } from 'astro:content';
const lessons = defineCollection({
type: 'data',
schema: z.object({
name: z.string(),
slug: z.string(),
description: z.string(),
url: z.string().url(),
learnerCategory: z.string(),
educationalLevel: z.enum(['Beginner', 'Intermediate', 'Advanced']),
ossRole: z.string().optional(),
subTopic: z.string().optional(),
timeRequired: z.string().optional(),
keywords: z.array(z.string()).optional(),
author: z.string().optional(),
license: z.string().optional(),
}),
});
export const collections = { lessons };Acceptance Criteria
- Content collections configured in
src/content/config.ts - Zod schema includes all required lesson fields
- Can query lessons using
getCollection('lessons') - TypeScript validation works (build fails on invalid data)
- At least 2-3 example lesson files created and validated
References
- Astro Content Collections
- Zod Schema Validation
.github/MIGRATION_TO_KEYSTATIC.md
Time Estimate
3-4 hours
Dependencies
Can start independently, but works best after Keystatic setup (#36)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
educationfeaturephase-2-enhancementJanuary 2025 student workJanuary 2025 student workpriority: highImportant for Phase 2Important for Phase 2student-readyReady for student to pick upReady for student to pick upteam: internalWork being handled by internal student developersWork being handled by internal student developers
Type
Projects
Status
In Progress