Documentation
¶
Index ¶
- func Abs(input interface{}, args ...interface{}) interface{}
- func AbsoluteURL(input interface{}, args ...interface{}) interface{}
- func Append(input interface{}, args ...interface{}) interface{}
- func ApplyFilter(name string, input interface{}, args ...interface{}) interface{}
- func CacheBust(input interface{}, args ...interface{}) interface{}
- func Capitalize(input interface{}, args ...interface{}) interface{}
- func Ceil(input interface{}, args ...interface{}) interface{}
- func Compact(input interface{}, args ...interface{}) interface{}
- func Complement(input interface{}, args ...interface{}) interface{}
- func Concat(input interface{}, args ...interface{}) interface{}
- func Contains(input interface{}, args ...interface{}) interface{}
- func DateFormat(input interface{}, args ...interface{}) interface{}
- func Default(input interface{}, args ...interface{}) interface{}
- func DetectCircularLayouts(layoutsDir string) error
- func DiscoverRenderHooks(layoutsDir, engine string) (map[string]string, error)
- func DividedBy(input interface{}, args ...interface{}) interface{}
- func Downcase(input interface{}, args ...interface{}) interface{}
- func Escape(input interface{}, args ...interface{}) interface{}
- func ExtractLayoutParent(path string) string
- func FindRE(input interface{}, args ...interface{}) interface{}
- func Fingerprint(input interface{}, args ...interface{}) interface{}
- func First(input interface{}, args ...interface{}) interface{}
- func Flatten(input interface{}, args ...interface{}) interface{}
- func Floor(input interface{}, args ...interface{}) interface{}
- func GetHash(input interface{}, args ...interface{}) interface{}
- func GroupBy(input interface{}, args ...interface{}) interface{}
- func InitMarkdownify(opts content.MarkdownOptions)
- func Intersect(input interface{}, args ...interface{}) interface{}
- func IsBuiltinFilter(name string) bool
- func JSONFilter(input interface{}, args ...interface{}) interface{}
- func Join(input interface{}, args ...interface{}) interface{}
- func Last(input interface{}, args ...interface{}) interface{}
- func Map(input interface{}, args ...interface{}) interface{}
- func Markdownify(input interface{}, args ...interface{}) interface{}
- func Minus(input interface{}, args ...interface{}) interface{}
- func Modulo(input interface{}, args ...interface{}) interface{}
- func NewlineToBr(input interface{}, args ...interface{}) interface{}
- func Plus(input interface{}, args ...interface{}) interface{}
- func Prepend(input interface{}, args ...interface{}) interface{}
- func RegisterAssetFilters(projectRoot string, subdirs ...string)
- func RegisterBlockShortcode(name string, fn BlockShortcodeFunc) error
- func RegisterBuiltinFilters(engine TemplateEngine) error
- func RegisterInlineTag(engine TemplateEngine)
- func RegisterShortcode(name string, fn ShortcodeFunc) error
- func RenderTemplate(source string, sourcePath string, ctx map[string]interface{}) (string, error)
- func Replace(input interface{}, args ...interface{}) interface{}
- func ReplaceFirst(input interface{}, args ...interface{}) interface{}
- func ReplaceRE(input interface{}, args ...interface{}) interface{}
- func ResetShortcodes()
- func ResolveLayout(page *content.Page, layoutsDir string, engine string, ...) (string, error)
- func ResolveLayoutChain(layoutPath string, layoutsDir string, engine string) ([]string, error)
- func ResolveLayoutForFormat(page *content.Page, layoutsDir string, engine string, format string) (string, error)
- func ResolveLayoutWithCascade(page *content.Page, layoutsDir, engine string, permalinkCfg map[string]string, ...) (string, error)
- func ResolveTaxonomyLayout(taxonomyName string, layoutOverride string, layoutsDir string, engine string) (string, error)
- func Reverse(input interface{}, args ...interface{}) interface{}
- func Round(input interface{}, args ...interface{}) interface{}
- func SafeHTML(input interface{}, args ...interface{}) interface{}
- func Size(input interface{}, args ...interface{}) interface{}
- func Slugify(input interface{}, args ...interface{}) interface{}
- func Sort(input interface{}, args ...interface{}) interface{}
- func Split(input interface{}, args ...interface{}) interface{}
- func Strip(input interface{}, args ...interface{}) interface{}
- func StripHTML(input interface{}, args ...interface{}) interface{}
- func StripLayoutFrontMatter(s string) string
- func Times(input interface{}, args ...interface{}) interface{}
- func Truncate(input interface{}, args ...interface{}) interface{}
- func TruncateWords(input interface{}, args ...interface{}) interface{}
- func URLDecode(input interface{}, args ...interface{}) interface{}
- func URLEncode(input interface{}, args ...interface{}) interface{}
- func URLFilter(input interface{}, args ...interface{}) interface{}
- func Union(input interface{}, args ...interface{}) interface{}
- func Uniq(input interface{}, args ...interface{}) interface{}
- func Upcase(input interface{}, args ...interface{}) interface{}
- func Where(input interface{}, args ...interface{}) interface{}
- type BlockShortcodeFunc
- type FilterFunc
- type PageContext
- type ShortcodeFunc
- type SiteContext
- type TagFunc
- type Template
- type TemplateContext
- type TemplateEngine
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AbsoluteURL ¶
func AbsoluteURL(input interface{}, args ...interface{}) interface{}
func ApplyFilter ¶
func ApplyFilter(name string, input interface{}, args ...interface{}) interface{}
ApplyFilter dispatches a filter by name with the given input and optional arguments.
func Capitalize ¶
func Capitalize(input interface{}, args ...interface{}) interface{}
func Complement ¶
func Complement(input interface{}, args ...interface{}) interface{}
func DateFormat ¶
func DateFormat(input interface{}, args ...interface{}) interface{}
func DetectCircularLayouts ¶
DetectCircularLayouts checks for circular references in layout chains.
func DiscoverRenderHooks ¶
func ExtractLayoutParent ¶
ExtractLayoutParent reads a layout file and looks for a parent layout reference in its front matter. Returns the parent layout name, or "" if none found.
func Fingerprint ¶
func Fingerprint(input interface{}, args ...interface{}) interface{}
func InitMarkdownify ¶
func InitMarkdownify(opts content.MarkdownOptions)
InitMarkdownify creates the shared goldmark instance for the markdownify filter using config-driven options. Called from createEngine after config is loaded. TemplateTags is always false: markdownify processes values that have already been through template rendering, so tag protection is not needed.
func IsBuiltinFilter ¶
IsBuiltinFilter reports whether name is a known built-in filter.
func JSONFilter ¶
func JSONFilter(input interface{}, args ...interface{}) interface{}
func Markdownify ¶
func Markdownify(input interface{}, args ...interface{}) interface{}
func NewlineToBr ¶
func NewlineToBr(input interface{}, args ...interface{}) interface{}
func RegisterAssetFilters ¶
func RegisterBlockShortcode ¶
func RegisterBlockShortcode(name string, fn BlockShortcodeFunc) error
RegisterBlockShortcode registers a block shortcode (with inner content).
func RegisterBuiltinFilters ¶
func RegisterBuiltinFilters(engine TemplateEngine) error
RegisterBuiltinFilters registers all Tier 1 built-in filters on the given engine.
func RegisterInlineTag ¶
func RegisterInlineTag(engine TemplateEngine)
RegisterInlineTag registers the {% inline %} tag on the given engine. The tag reads a file relative to the content file's directory and inserts its raw contents without template processing.
func RegisterShortcode ¶
func RegisterShortcode(name string, fn ShortcodeFunc) error
RegisterShortcode registers a shortcode that works in both Liquid and Go template engines.
func RenderTemplate ¶
RenderTemplate renders a template string with the given context. Returns an error that includes the source file path on failure.
func ReplaceFirst ¶
func ReplaceFirst(input interface{}, args ...interface{}) interface{}
func ResetShortcodes ¶
func ResetShortcodes()
ResetShortcodes clears all registered shortcodes (useful for testing).
func ResolveLayout ¶
func ResolveLayout(page *content.Page, layoutsDir string, engine string, permalinkCfg map[string]string) (string, error)
ResolveLayout finds the correct layout file for a page following the lookup order: 1. Front matter layout 2. "post" (for pages in date-based permalink sections) 3. Section name (for index pages) 4. Filename (without extension) 5. "default" Returns error if no layout file is found on disk.
func ResolveLayoutChain ¶
ResolveLayoutChain follows layout: directives in layout front matter to build the full chain from innermost to root. Returns the ordered list of layout file paths. Returns error if the chain exceeds maxDepth (10) or if a referenced layout is not found.
func ResolveLayoutForFormat ¶
func ResolveLayoutForFormat(page *content.Page, layoutsDir string, engine string, format string) (string, error)
ResolveLayoutForFormat finds the correct layout for a specific output format.
func ResolveLayoutWithCascade ¶
func ResolveLayoutWithCascade(page *content.Page, layoutsDir, engine string, permalinkCfg map[string]string, cascadeData map[string]interface{}) (string, error)
ResolveLayoutWithCascade resolves layout considering cascade data.
func ResolveTaxonomyLayout ¶
func ResolveTaxonomyLayout(taxonomyName string, layoutOverride string, layoutsDir string, engine string) (string, error)
ResolveTaxonomyLayout finds the layout for a taxonomy page. Lookup: layouts/taxonomies/<name>.<ext> → layouts/<name>.<ext>
func StripLayoutFrontMatter ¶
StripLayoutFrontMatter removes YAML front matter (--- delimited) from layout content. Returns the content after the closing --- delimiter.
func TruncateWords ¶
func TruncateWords(input interface{}, args ...interface{}) interface{}
Types ¶
type BlockShortcodeFunc ¶
BlockShortcodeFunc handles block shortcodes (with inner content).
type FilterFunc ¶
type FilterFunc func(input interface{}, args ...interface{}) interface{}
FilterFunc is the signature for template filter functions.
type PageContext ¶
type PageContext struct {
Title string
URL string
Date interface{}
Collection string
FrontMatter map[string]interface{}
Translations []map[string]interface{} // translation info: url, lang
TOC []content.TOCEntry
}
PageContext holds per-page data available as {{ page.* }}.
type ShortcodeFunc ¶
ShortcodeFunc handles inline shortcodes (no inner content).
func GetShortcode ¶
func GetShortcode(name string) (ShortcodeFunc, error)
GetShortcode returns a registered inline shortcode by name.
type SiteContext ¶
type SiteContext struct {
Title string
BaseURL string
Language string
LanguageData map[string]interface{} // structured language data (code, title, root, strings)
Data map[string]interface{}
Pages []*content.Page
}
SiteContext holds site-wide data available as {{ site.* }}.
type TemplateContext ¶
type TemplateContext struct {
Site SiteContext
Page PageContext
Collections map[string]interface{}
Taxonomies map[string]interface{}
Content string // rendered HTML body
Pagination *pagination.PaginationContext
Custom map[string]interface{} // dynamic top-level variables (e.g., pagination "as" alias)
}
TemplateContext is the complete context object passed to templates during rendering.
func BuildTemplateContext ¶
func BuildTemplateContext(page *content.Page, siteData map[string]interface{}, allPages []*content.Page, collections map[string]interface{}, taxonomies map[string]interface{}, pagCtx *pagination.PaginationContext, asName string) *TemplateContext
BuildTemplateContext assembles the complete template context for rendering a page. For paginated pages, pass the PaginationContext and the "as" variable name. For non-paginated pages, pass nil and "".
func (*TemplateContext) ToMap ¶
func (tc *TemplateContext) ToMap() map[string]interface{}
ToMap converts the TemplateContext to a raw map[string]interface{} for use with template engines (e.g., osteele/liquid) that require a plain map. The map shape matches the spec §3 context: page.*, site.*, collections.*, taxonomies.*, with pagination and custom "as" variables hoisted to the top level.
type TemplateEngine ¶
type TemplateEngine interface {
Parse(name string, content []byte) (Template, error)
AddFilter(name string, fn FilterFunc) error
AddTag(name string, fn TagFunc) error
}
TemplateEngine is the abstraction over Liquid and Go template engines.
func NewGoEngine ¶
func NewGoEngine() TemplateEngine
NewGoEngine creates a new Go html/template engine.
func NewLiquidEngine ¶
func NewLiquidEngine() TemplateEngine
NewLiquidEngine creates a new Liquid template engine with standard tags and filters.