Documentation
¶
Overview ¶
Package json provides a MetaLoader for JSON-formatted frontmatter.
Frontmatter is a JSON object at the start of the file, terminated by a closing }\n on its own line:
{
"title": "My Post",
"tags": ["go", "web"]
}
body content here
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Loader = func(raw []byte) (map[string]any, []byte, error) { head, body := split(raw) if head == nil { return map[string]any{}, body, nil } meta := map[string]any{} if err := stdjson.Unmarshal(head, &meta); err != nil { return nil, nil, err } return meta, body, nil }
Loader parses JSON frontmatter and returns the metadata and body. Files with no {\n prefix are returned as body-only with empty metadata.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.