Rustelo/resources/nickel/content/metadata/activity_metadata.ncl
Jesús Pérez f1010e9d07
chore: update
2026-07-18 20:16:16 +01:00

99 lines
2.7 KiB
Text

# Activity Metadata Schema
#
# Extends PostMetadata with activity-specific fields (talks, workshops, events).
# The `metadata` field carries event-specific data: type, location, slides, downloads.
#
# Usage — preferred (make_activity factory):
#
# let schema = import "content/metadata/activity_metadata.ncl" in
# schema.make_activity {
# id = "rust-async-patterns-2026",
# title = "Rust Async Patterns in Production",
# slug = "rust-async-patterns",
# date = "2026-03-15",
# category = "talks",
# }
let c = import "contracts.ncl" in
let post = import "post_metadata.ncl" in
let d = import "defaults.ncl" in
{
ActivityEventMetadata = {
event_type
| String
| doc "Activity kind: 'talk' | 'workshop' | 'webinar' | 'panel' | 'other'"
| optional,
event_date
| String
| c.DateContract
| doc "Date of the event (ISO 8601). May differ from the post date."
| optional,
event_location
| String
| doc "City or venue name. Empty string or absent for online events."
| optional,
slides_id
| String
| doc "Identifier used to derive the slides URL or file path."
| optional,
pdf_filename
| String
| doc "Filename of the downloadable PDF (relative to the slides asset directory)."
| optional,
repository_url
| String
| doc "URL to the companion source code repository."
| optional,
questionnaire_type
| String
| doc "Gating mechanism for downloads: 'internal' | 'external' | 'none'."
| optional,
questionnaire_config
| String
| doc "Identifier of the questionnaire configuration used for gating."
| optional,
download_requires_auth
| Bool
| doc "Require authenticated session before allowing download."
| default = false,
download_requires_questionnaire
| Bool
| doc "Require questionnaire completion before allowing download."
| default = false,
gallery
| Array String
| doc "List of image filenames or URLs for the activity photo gallery."
| default = [],
..
},
ActivityMetadata = post.PostMetadata & {
sort_order
| Number
| doc "Display order within the category listing. Lower values appear first."
| default = 100,
metadata
| ActivityEventMetadata
| doc "Activity-specific event metadata (location, slides, downloads, etc.)."
| default = {},
},
make_activity
| not_exported
| doc "Create a validated activity metadata record. Provide at minimum: title, slug, date, category."
= fun overrides =>
d & overrides | ActivityMetadata,
}