# Unified Site Configuration Defaults and Helpers # # Provides make_route, make_content_route, make_external and shared # priority/order constants for site.ncl. # # All helpers return open records so callers can merge additional fields # with the & operator. let contracts = import "contracts.ncl" in { # SEO priority constants priorities = { critical = 1.0, high = 0.9, normal = 0.8, low = 0.5, minimal = 0.3, }, # Default menu order constants for consistent navigation orders = { home = 1, about = 2, services = 3, portfolio = 4, projects = 5, blog = 6, recipes = 7, contact = 10, external = 100, }, # Sentinel for routes that do not appear in any navigation menu no_menu = { enabled = false, visible_in = [], }, # make_route # # Create a standard page route covering multiple languages. # # Parameters: # component : String — Component name, e.g. "HomePage" # path_map : Record — Language → URL, e.g. { en = "/", es = "/inicio" } # # Returns a Route record with priority and menu set to defaults. # Callers add specifics with & { priority = ..., menu = { ... } }. make_route | String -> { _ : String } -> Dyn = fun comp path_map => { component = comp, paths = path_map, priority | default = 0.8, menu | default = { enabled = false, visible_in = [] }, }, # make_content_route # # Like make_route but also sets content_type for dynamic content pages. # # Parameters: # comp : String — Component name (typically "ContentIndex") # ct : String — Content kind, e.g. "blog", "recipes" # path_map : Record — Language → URL make_content_route | String -> String -> { _ : String } -> Dyn = fun comp ct path_map => make_route comp path_map & { content_type = ct, }, # make_external # # Create an external link entry (same URL for all languages). # Produces a Route record with component = "ExternalLink". # # Parameters: # lbl : String — Display label (used as fallback for all languages) # ext_url : String — Full external URL make_external | String -> String -> Dyn = fun lbl ext_url => { component = "ExternalLink", paths = { external = ext_url }, priority = 0.3, menu = { enabled = true, labels = { en = lbl, es = lbl }, visible_in | default = [], }, }, }