added proper frontmatter struct

This commit is contained in:
Daniel Fichtinger 2025-05-03 00:17:34 -04:00
parent 99bc128578
commit 3355bc5544
2 changed files with 28 additions and 18 deletions

View file

@ -10,17 +10,17 @@ import (
"gopkg.in/yaml.v3"
)
func processFrontmatter(p string) (Metadata, int, error) {
func processFrontmatter(p string) (*FrontMatter, int, error) {
f, l, err := readFrontmatter(p)
if err != nil {
return nil, l, err
}
var meta Metadata
var meta FrontMatter
// Parse YAML
if err := yaml.Unmarshal(f, &meta); err != nil {
return nil, l, fmt.Errorf("yaml frontmatter could not be parsed: %w", err)
}
return meta, l, nil
return &meta, l, nil
}
// readFrontmatter reads the file at `path` and scans