frontmatter

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteFile

func WriteFile(path string, meta Meta, body []byte) error

WriteFile rewrites the Markdown file with updated front-matter.

Types

type Meta

type Meta struct {
	Title          string   `yaml:"title"`
	Slug           string   `yaml:"slug,omitempty"`
	Status         string   `yaml:"status,omitempty"` // draft | published | scheduled
	PublishedAt    string   `yaml:"published_at,omitempty"`
	Visibility     string   `yaml:"visibility,omitempty"` // public | members | paid | specific
	Tiers          []string `yaml:"tiers,omitempty"`
	Featured       bool     `yaml:"featured,omitempty"`
	CustomExcerpt  string   `yaml:"custom_excerpt,omitempty"`
	Authors        []string `yaml:"authors,omitempty"`
	CustomTemplate string   `yaml:"custom_template,omitempty"`
	FeatureImage   string   `yaml:"feature_image,omitempty"`
	Tags           []string `yaml:"tags,omitempty"`
	PostID         string   `yaml:"post_id,omitempty"` // set after first publish
	Hash           string   `yaml:"hash,omitempty"`    // SHA256 of Markdown body
}

Meta holds every key ghostpost cares about. Add more tags as your workflow grows.

func ParseFile

func ParseFile(path string) (Meta, []byte, error)

ParseFile reads a Markdown file and returns its meta + body bytes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址