Rustelo/resources/nickel/content/contracts.ncl

132 lines
3.1 KiB
Text
Raw Normal View History

2026-07-18 20:16:16 +01:00
# Content Types Configuration Contracts
#
# Type contracts for content-kinds configuration with comprehensive validation
# and documentation for each field.
{
# Content features configuration
ContentFeatures = {
style_mode
| String
| doc "Display mode for content (e.g., 'row', 'grid', 'masonry')",
style_css
| String
| doc "CSS class prefix for styling (e.g., 'blog-content', 'recipe-content')",
use_feature
| Bool
| doc "Enable featured content highlighting",
use_categories
| Bool
| doc "Enable category organization and filtering",
use_tags
| Bool
| doc "Enable tag-based classification and search",
use_emojis
| Bool
| doc "Enable emoji support in content display",
cta_view
| String
| doc "Call-to-action component name (e.g., 'BlogCTAView', 'RecipesCTAView')",
# Pagination features
default_page_size
| Number
| doc "Default number of items per page"
| optional,
page_size_options
| Array Number
| doc "Available page size options for users (e.g., [5, 10, 20])"
| optional,
show_page_info
| Bool
| doc "Display pagination information (e.g., 'Showing 1-10 of 50')"
| optional,
pagination_style
| String
| doc "Pagination UI style (e.g., 'numbered', 'simple', 'infinite')"
| optional,
# Specialized features (for tutorial content, etc.)
show_difficulty
| Bool
| doc "Display difficulty level indicator"
| optional,
show_duration
| Bool
| doc "Display estimated time/duration"
| optional,
show_prerequisites
| Bool
| doc "Display required prerequisites"
| optional,
},
# Content kind/type configuration
ContentKind = {
name
| String
| doc "Unique identifier for this content type (e.g., 'blog', 'recipes')",
directory
| String
| doc "Directory name where content is stored (relative to content root)",
enabled
| Bool
| doc "Whether this content type is active and should be processed"
| default = true,
is_default
| Bool
| doc "Whether this is the default/fallback content type"
| optional,
specialized
| Bool
| doc "Whether this content type has specialized handling (may have schema differences)"
| optional,
features
| ContentFeatures
| doc "Feature configuration for this content type",
},
# Root configuration structure
ContentKindsFile = {
content_kinds
| Array ContentKind
| doc "Array of content type configurations",
},
# Taxonomy entry used for categories and tags
TaxonomyEntry = {
id | String,
slug | String,
emoji | String | default = "",
icon | String | default = "",
},
# Standalone content metadata file (blog.ncl, recipes.ncl, etc.)
ContentMetadata = {
content_type = {
id | String,
slug | String,
name | String,
description | String,
},
categories | Array TaxonomyEntry | default = [],
tags | Array TaxonomyEntry | default = [],
},
}