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

129 lines
2.8 KiB
Text

# Route Configuration Type Contracts
#
# Defines the schema for route configuration with validation rules.
# Used by both en.ncl and es.ncl to ensure type safety and consistency.
{
# Single route configuration
Route = {
# Required fields
component
| String
| doc "Component name (e.g., 'Home', 'About', 'Services')",
path
| String
| doc "URL path (e.g., '/', '/about', '/services')",
language
| String
| doc "Language code (ISO 639-1, e.g., 'en', 'es')",
title_key
| String
| doc "i18n key for page title",
description_key
| String
| doc "i18n key for page description",
# Optional fields with defaults
enabled
| Bool
| doc "Whether this route is active"
| default = true,
canonical_path
| String
| doc "Canonical URL path for this route"
| optional,
keywords
| Array String
| doc "SEO keywords for this page"
| default = [],
lang_prefixes
| Array String
| doc "i18n key prefixes (e.g., ['home-', 'welcome-'])"
| default = [],
menu_group
| String
| doc "Menu grouping (e.g., 'main', 'footer', 'admin')"
| default = "main",
menu_icon
| String
| doc "Icon identifier for menu item"
| optional,
menu_order
| Number
| doc "Display order within menu group (lower = higher priority)"
| default = 999,
page_component
| String
| doc "Leptos component name (e.g., 'HomePage')"
| optional,
unified_component
| String
| doc "Unified component name for SSR/WASM delegation"
| optional,
module_path
| String
| doc "Module path for component (e.g., 'services')"
| optional,
priority
| Number
| doc "SEO/sitemap priority (0.0 to 1.0)"
| default = 0.8,
show_in_sitemap
| Bool
| doc "Whether to include in sitemap.xml"
| default = true,
generate_boilerplate_only
| Bool
| doc "Only generate boilerplate code (no full implementation)"
| default = false,
replace_existing_boilerplate
| Bool
| doc "Replace existing boilerplate if it exists"
| default = false,
is_external
| Bool
| doc "Whether this is an external URL"
| default = false,
component_dynamic
| Bool
| doc "Whether component is dynamically loaded"
| default = false,
content_type_param
| Bool
| doc "Whether route accepts content_type parameter"
| default = false,
# Dynamic properties (extensible)
props
| { _ : Dyn }
| doc "Additional dynamic properties (e.g., content_type, style)"
| optional,
},
# Container for all routes
RoutesFile = {
routes
| Array Route
| doc "List of all route configurations",
},
}