Help us shape the future of Go! Take the 2026 Go Developer Survey

content

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Content

type Content struct {
	// Partials are the HTML partials that can be used in layouts.
	Partials *partials.Partials
	// Goldmark is the Goldmark instance used for rendering Markdown.
	Goldmark goldmark.Markdown
	// Config is the site configuration.
	Config map[string]any
	// Plugins are the plugins that are currently loaded.
	Plugins []plugins.Plugin
	// LayoutCache is a cache of layouts that have been found for a given directory.
	LayoutCache sync.Map
	// TemplateCache is a cache of templates that have been parsed.
	TemplateCache sync.Map
	// Pipelines are the content pipelines that are currently loaded.
	Pipelines []pipelines.Pipeline
	// OutputDir is the directory where the site will be built.
	OutputDir string
	// contains filtered or unexported fields
}

Content is the main struct for handling content processing.

func New

func New(outputDir string, config map[string]any, partials *partials.Partials, gm goldmark.Markdown, plugins []plugins.Plugin, pipelines []pipelines.Pipeline) (*Content, error)

New creates a new Content struct.

func (*Content) GetLayouts

func (c *Content) GetLayouts(path string) []string

GetLayouts returns the layouts for a given path.

func (*Content) GetTemplate

func (c *Content) GetTemplate(layout string) (*template.Template, error)

GetTemplate returns a template from the cache or parses it if it's not in the cache.

func (*Content) ProcessLayouts

func (c *Content) ProcessLayouts(layouts []string, content []byte, frontMatter map[string]any) ([]byte, error)

ProcessLayouts processes the layouts for a given content file.

Jump to

Keyboard shortcuts

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