Documentation
¶
Index ¶
- func BuildCollectionIndex(docs []*Document, baseURL string, limit int) map[string]interface{}
- func BuildCollectionIndexWithMeta(docs []*Document, baseURL string, limit int, indexDoc *Document) map[string]interface{}
- func SerializeJSONLD(jsonld map[string]interface{}) ([]byte, error)
- func SortDocumentsByDate(docs []*Document)
- func ValidateFrontmatter(fm Frontmatter) error
- type Document
- type Frontmatter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildCollectionIndex ¶
BuildCollectionIndex creates a schema.org CollectionPage index limit controls how many items to include (0 means no limit)
func BuildCollectionIndexWithMeta ¶
func BuildCollectionIndexWithMeta(docs []*Document, baseURL string, limit int, indexDoc *Document) map[string]interface{}
BuildCollectionIndexWithMeta creates a schema.org CollectionPage index with optional metadata from index.md limit controls how many items to include (0 means no limit) indexDoc contains optional metadata like sameAs from the site's index.md
func SerializeJSONLD ¶
SerializeJSONLD serializes JSON-LD to formatted JSON
func SortDocumentsByDate ¶
func SortDocumentsByDate(docs []*Document)
SortDocumentsByDate sorts documents by DatePublished descending (newest first), then by Title ascending for items with the same date
func ValidateFrontmatter ¶
func ValidateFrontmatter(fm Frontmatter) error
ValidateFrontmatter validates frontmatter against required fields
Types ¶
type Document ¶
type Document struct {
Frontmatter Frontmatter
Content string // Raw markdown content
HTML string // Rendered HTML
FilePath string // Path to the source file
}
Document represents a parsed markdown document
func ListDocuments ¶
ListDocuments finds all markdown documents in a directory
func ParseDocument ¶
ParseDocument parses a markdown file with YAML frontmatter
func ParseDocumentFromBytes ¶
ParseDocumentFromBytes parses markdown content with YAML frontmatter
func ParseIndexDocument ¶
ParseIndexDocument parses an index.md file with minimal frontmatter requirements Unlike regular documents, index.md doesn't require datePublished, author, or lang
type Frontmatter ¶
type Frontmatter struct {
Title string `yaml:"title" json:"title"`
Description string `yaml:"description,omitempty" json:"description,omitempty"`
DatePublished string `yaml:"datePublished,omitempty" json:"datePublished,omitempty"`
DateModified string `yaml:"dateModified,omitempty" json:"dateModified,omitempty"`
Author interface{} `yaml:"author,omitempty" json:"author,omitempty"`
Tags []string `yaml:"tags,omitempty" json:"tags,omitempty"`
Collection string `yaml:"collection,omitempty" json:"collection,omitempty"`
Lang string `yaml:"lang,omitempty" json:"lang,omitempty"`
Draft bool `yaml:"draft,omitempty" json:"draft,omitempty"`
Slug string `yaml:"slug,omitempty" json:"slug,omitempty"`
Image string `yaml:"image,omitempty" json:"image,omitempty"`
Keywords []string `yaml:"keywords,omitempty" json:"keywords,omitempty"`
Icon string `yaml:"icon,omitempty" json:"icon,omitempty"`
SameAs []string `yaml:"sameAs,omitempty" json:"sameAs,omitempty"`
}
Frontmatter represents the YAML frontmatter of a document