template

package
v0.0.0-...-8451b87 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasePage

type BasePage struct {
	// HTMLTitle is the value to use in the page’s <title> tag.
	HTMLTitle string

	// MetaDescription is the html used for rendering the <meta name="Description"> tag.
	MetaDescription safehtml.HTML
}

BasePage for structure data pass to template

type Template

type Template struct {
	Templates map[string]*template.Template
}

func (*Template) NewBasePage

func (t *Template) NewBasePage(_ *http.Request, title string) BasePage

newBasePage returns a base page for the given request and title.

func (*Template) RenderPage

func (t *Template) RenderPage(templateName string, page any) ([]byte, error)

renderPage executes the given templateName with page.

func (*Template) ServePage

func (t *Template) ServePage(w http.ResponseWriter, templateName string, page any)

servePage is used to execute all templates for a *Server.

func (*Template) StaticPageHandler

func (t *Template) StaticPageHandler(templateName, title string) http.HandlerFunc

staticPageHandler handles requests to a template that contains no dynamic content.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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