templates

package
v2.5.0-beta1 Latest Latest
Warning

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

Go to latest
Published: May 22, 2026 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package templates provides embedded default templates for the GoBlog system.

The Default variable contains the embedded filesystem with default HTML templates used by the generator when no custom templates are provided.

Index

Constants

This section is empty.

Variables

View Source
var Default fs.FS = func() fs.FS {
	sub, err := fs.Sub(rawDefault, "default")
	if err != nil {
		panic("embedded default templates are missing the 'default/' directory: " + err.Error())
	}
	return sub
}()

Default is the embedded default template tree used by the generator when no custom templates are supplied. It is rooted at the templates directory so that paths such as "pages/post.tmpl" are directly accessible without any "default/" prefix, matching the layout expected by github.com/harrydayexe/GoBlog/v2/pkg/generator.NewTemplateRenderer.

Its directory layout — which any custom fs.FS passed to NewTemplateRenderer must mirror — is:

pages/
  post.tmpl          executed by TemplateRenderer.RenderPost
  index.tmpl         executed by TemplateRenderer.RenderIndex
  tag.tmpl           executed by TemplateRenderer.RenderTag
  tags-index.tmpl    executed by TemplateRenderer.RenderTagsIndex
partials/
  head.tmpl          {{define "head"}}
  header.tmpl        {{define "header"}}
  footer.tmpl        {{define "footer"}}
  post-card.tmpl     {{define "post-card"}}
layouts/
  base.tmpl          loaded but not executed; pages are self-contained

Each page template is a complete HTML document that references partials via {{template "head" .}}, {{template "header" .}}, etc. Custom templates must follow the same convention: define the four named blocks in their partials/ directory and reference them from each page template.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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