Documentation
¶
Overview ¶
Package html provides HTML rendering capabilities using both Fiber's engine and standard template rendering with security headers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResponseSecurityHeadersFiber ¶
ResponseSecurityHeadersFiber sets the security headers for the response according to best practices
func ResponseSecurityHeadersStd ¶
func ResponseSecurityHeadersStd(w http.ResponseWriter)
Types ¶
type RendererFiber ¶
type RendererFiber struct {
// contains filtered or unexported fields
}
func NewRendererFiber ¶
func NewRendererFiber(reload bool, viewsfs embed.FS, extDir string, extension string) (*RendererFiber, error)
NewRendererFiber creates a new HTML renderer to be used in Fiber handlers. It supports both embedded templates (in viewsfs) and external templates (in extDir). If reload is true, the templates are loaded from the directory specified in extDir. If reload is false, the templates are loaded from the embedded directory. viewsfs is the filesystem containing the views. extDir is the directory containing the external templates.
type RendererStd ¶
type RendererStd struct {
// contains filtered or unexported fields
}
func NewRendererStd ¶
func NewRendererStd(reload bool, viewsfs embed.FS, extDir string, extension string) (*RendererStd, error)
NewRendererStd creates a new HTML renderer to be used in standard http handlers. It supports both embedded templates (in viewsfs) and external templates (in extDir). If reload is true, the templates are loaded from the directory specified in extDir. If reload is false, the templates are loaded from the embedded directory. viewsfs is the filesystem containing the views. extDir is the directory containing the external templates.
func (*RendererStd) Render ¶
func (h *RendererStd) Render(w http.ResponseWriter, templateName string, data map[string]any, layout ...string) error