Documentation
¶
Overview ¶
Package load assembles a site's `.norcube/cms/` directory (or the legacy single `norcube-cms.config.yml`) into one merged document, the same way the CMS service does: `config.yml` supplies the root keys, each file under `collections/`, `blocks/` and `inputs/` becomes one entry keyed by its basename, `inputsFromGlob` adds more inputs, every `$ref` is replaced by the block or input it names, and the schema version is checked.
Unlike the service, which skips a file it cannot parse with a log line, Load reports every such problem as a finding and keeps going, so a site author sees all of them at once.
Index ¶
Constants ¶
const ( ConfigDir = ".norcube/cms" ConfigFile = ConfigDir + "/config.yml" CollectionsDir = ConfigDir + "/collections" BlocksDir = ConfigDir + "/blocks" InputsDir = ConfigDir + "/inputs" LegacyConfigFile = "norcube-cms.config.yml" )
Paths inside a site.
Variables ¶
var ErrNotASite = errors.New("no .norcube/cms/config.yml and no norcube-cms.config.yml")
ErrNotASite is returned when neither the directory layout nor the legacy file exists.
Functions ¶
func CollectionFile ¶
CollectionFile, BlockFile and InputFile name the file a schema entry lives in under the directory layout.
Types ¶
type Document ¶
type Document struct {
// Root is the merged mapping after `$ref` resolution, with every
// key in source order.
Root *yaml.Node
// Merged is Root as plain values.
Merged map[string]any
// Config is the typed view of Merged.
Config *schema.Config
// Files lists the schema files that were read, in load order.
Files []string
// Legacy is true when the single-file layout was used.
Legacy bool
}
Document is the loaded configuration.