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

type Resource = {
  title: string;
  description: string;
  category: string;
  featured?: boolean;
  date: Date;
  author?: string;
  thumbnail?: string;
  fileType?: string;
  fileSize?: string;
  downloadUrl?: string;
  resourceUrl?: string;
  lastUpdated?: Date;
  languages?: string[];
  tags?: string[];
};

Fields

Core Fields

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

File Information

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

Metadata

lastUpdated
Date
When the resource was last updated or modified.
languages
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:
{
  "title": "Banking services in Dzaleka Refugee Camp",
  "description": "New Finance Bank opened its branch of service in Dzaleka Refugee Camp on 12 April 2018.",
  "date": "2019-03-01T00:00:00.000Z",
  "category": "Situation Reports / Updates",
  "fileType": "pdf",
  "resourceUrl": "https://data.unhcr.org/en/documents/details/68623",
  "downloadUrl": "https://data.unhcr.org/en/documents/download/68623",
  "fileSize": "748.24 KB",
  "lastUpdated": "2024-12-27T00:00:00.000Z",
  "languages": ["English"],
  "featured": false,
  "author": "UNHCR Malawi"
}

Usage in Content

Resources are stored as Markdown files in src/content/resources/ with YAML frontmatter:
---
title: Banking services in Dzaleka Refugee Camp
description: New Finance Bank opened its branch of service in Dzaleka Refugee Camp on 12 April 2018.
date: 2019-03-01
category: Situation Reports / Updates
fileType: pdf
resourceUrl: https://data.unhcr.org/en/documents/details/68623
downloadUrl: 'https://data.unhcr.org/en/documents/download/68623'
fileSize: '748.24 KB'
lastUpdated: 2024-12-27
languages: ['English']
featured: false
author: UNHCR Malawi
---

## About Report

New Finance Bank opened its branch of service in Dzaleka Refugee Camp on 12 April 2018.

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
{
  "fileType": "pdf",
  "downloadUrl": "https://example.com/document.pdf",
  "fileSize": "2.3 MB"
}
Use resourceUrl for resources hosted elsewhere:
  • Web pages
  • Online tools
  • External databases
  • Video platforms
{
  "resourceUrl": "https://example.com/resource-page",
  "fileType": "link"
}

Hybrid Resources

Some resources have both viewing and download options:
{
  "resourceUrl": "https://data.unhcr.org/en/documents/details/68623",
  "downloadUrl": "https://data.unhcr.org/en/documents/download/68623",
  "fileType": "pdf",
  "fileSize": "748.24 KB"
}

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:
{
  "title": "Community Guide to Services",
  "languages": ["English", "French", "Swahili", "Kinyarwanda"]
}
This helps users filter and find resources in their preferred language.