Skip to main content

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 in src/content.config.ts:78-94.

TypeScript Type

Fields

Core Fields

string
required
The title of the resource document or material.
string
required
A clear description of what the resource contains and its purpose.
string
required
The category of resource (e.g., “Situation Reports / Updates”, “Educational Materials”, “Legal Documents”, “Community Guides”).
Date
required
The publication or creation date of the resource.
string
The author or organization that created the resource (e.g., “UNHCR Malawi”).
Whether this resource should be featured prominently on the platform.
string
Path or URL to a thumbnail image representing the resource.
string[]
Array of tags for categorization and searchability.

File Information

string
The type of file (e.g., “pdf”, “docx”, “video”, “link”).
string
Human-readable file size (e.g., “748.24 KB”, “2.5 MB”).
string
Direct download URL for the resource file. Use this for downloadable files like PDFs.
string
URL to view or access the resource online (not necessarily for download).

Metadata

Date
When the resource was last updated or modified.
string[]
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 in src/content/resources/ with YAML frontmatter:

Resource Types

Resources can take several forms:

Downloadable Files

Use downloadUrl for files that users can download:
  • PDF documents
  • Word documents
  • Spreadsheets
  • Images
  • Archive files
Use resourceUrl 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, and date are required fields
  • At least one of downloadUrl or resourceUrl should be provided for the resource to be accessible
  • date must be a valid Date object or ISO 8601 string
  • languages should use standardized language names (e.g., “English”, not “EN”)
  • fileSize should 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

The languages field allows resources to indicate availability in multiple languages:
This helps users filter and find resources in their preferred language.