Overview
The Resource model represents documents, guides, reports, and educational materials available to the Dzaleka community. Resources can include PDFs, links to external content, educational materials, and informational documents.Schema Definition
The Resource model is defined using Zod schema validation insrc/content.config.ts:78-94.
TypeScript Type
Fields
Core Fields
The title of the resource document or material.
A clear description of what the resource contains and its purpose.
The category of resource (e.g., “Situation Reports / Updates”, “Educational Materials”, “Legal Documents”, “Community Guides”).
The publication or creation date of the resource.
The author or organization that created the resource (e.g., “UNHCR Malawi”).
Whether this resource should be featured prominently on the platform.
Path or URL to a thumbnail image representing the resource.
Array of tags for categorization and searchability.
File Information
The type of file (e.g., “pdf”, “docx”, “video”, “link”).
Human-readable file size (e.g., “748.24 KB”, “2.5 MB”).
Direct download URL for the resource file. Use this for downloadable files like PDFs.
URL to view or access the resource online (not necessarily for download).
Metadata
When the resource was last updated or modified.
Array of languages the resource is available in (e.g., [“English”, “French”, “Swahili”]).
Example
Here’s a complete example of a Resource object for a UNHCR report:Usage in Content
Resources are stored as Markdown files insrc/content/resources/ with YAML frontmatter:
Resource Types
Resources can take several forms:Downloadable Files
UsedownloadUrl for files that users can download:
- PDF documents
- Word documents
- Spreadsheets
- Images
- Archive files
External Links
UseresourceUrl for resources hosted elsewhere:
- Web pages
- Online tools
- External databases
- Video platforms
Hybrid Resources
Some resources have both viewing and download options:Validation Rules
title,description,category, anddateare required fields- At least one of
downloadUrlorresourceUrlshould be provided for the resource to be accessible datemust be a valid Date object or ISO 8601 stringlanguagesshould use standardized language names (e.g., “English”, not “EN”)fileSizeshould be human-readable (e.g., “1.5 MB” rather than “1500000”)- URLs should be complete and include protocol (https://)
Categories
Common resource categories include:- Situation Reports / Updates - Current information about camp conditions and changes
- Educational Materials - Learning resources and guides
- Legal Documents - Rights, policies, and legal information
- Community Guides - How-to guides for community members
- Health Resources - Medical and health-related information
- Business Resources - Entrepreneurship and business guides
- Cultural Materials - Art, history, and cultural documentation
Multilingual Support
Thelanguages field allows resources to indicate availability in multiple languages: