Resume Feature Logic
Relevant source files
The following files were used as context for generating this wiki page:
The Resume feature manages the retrieval, validation, and processing of professional data stored as YAML files. It transforms raw content collection entries into a structured resume object used by the frontend and API endpoints. The system handles various resume sections including professional experience, education, skills, and personal information.
Sources: src/features/resume/resume.server.ts, src/content.config.ts
Data Architecture and Processing
The system loads resume data through Astro's content collection API. It uses a custom loader to glob YAML files from src/content/resume. The assembleResumeData function processes these entries by parsing their IDs to determine their section and depth.
Data Transformation Flow
The following diagram illustrates how raw YAML entries are transformed into the final resume structure.
Content ID Parsing
The system differentiates between top-level files (e.g., basics.yaml) and nested items within directories (e.g., experience/company.yaml).
- Top-level entries: Map directly to a key in the resume object.
- Nested entries: Are grouped into an array under the parent directory name.
Sources: src/features/resume/resume.utils.ts:18-30, src/features/resume/resume.utils.test.ts:15-30
Content Schemas
The system uses Zod to validate resume data shapes. The createResumeSchema function returns a union of all possible entry structures.
| Schema Name | Primary Fields | Constraints |
|---|---|---|
basicsSchema | name, email, label, location, profiles | Name is required; Profiles include network and URL. |
experienceSchema | company, position, startDate, endDate, highlights | Dates must be YYYY-MM or YYYY-MM-DD. |
educationSchema | institution, area, studyType | Institution is required. |
awardSchema | title, date, org, description | Title is required. |
skillsSchema | category, items | Items is an array of strings. |
Sources: src/features/resume/resume.schema.ts:1-105
Experience Date Validation
Experience items use a specific endDateSchema that accepts valid ISO date strings, the string 'present' (case-insensitive), or null.
const endDateSchema = z.union([
dateStringSchema,
z.string().refine((val) => val.toLowerCase() === 'present'),
z.null(),
]).optional()
Sources: src/features/resume/resume.schema.ts:13-22
API and Data Access
The project exposes resume data through server-side utilities and a dynamic JSON API route.
Server Utilities
| Function | Description |
|---|---|
getResumeData() | Retrieves the entire resume collection and assembles it into a ResumeData object. |
getResumeSection(id) | Fetches the full resume and returns only the specific requested section. |
pickResumeSection(data, id) | Pure utility to extract a key from a ResumeData object with safety checks. |
Sources: src/features/resume/resume.server.ts:7-17, src/features/resume/resume.utils.ts:54-60
JSON API Endpoint
The endpoint /api/resume/[section].json provides programmatic access to resume sections. It uses getStaticPaths to pre-generate routes based on existing YAML files.
Sorting Logic
Data is automatically sorted during assembly to ensure consistent display.
- Experience: Items are sorted by end date descending. Items marked as
nullor'present'are treated as current and appear first. - Dated Arrays: Other collections (like awards) are sorted using a standard
sortByDateDescutility.
Sources: src/features/resume/resume.utils.ts:32-45, src/features/resume/resume.utils.test.ts:32-42