pages

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	NakedContent bool
	Page         *page
	Sidebar      *page
	NoBoost      bool
	HotReload    bool
	MainDomain   bool
	RequestInfo  RequestInfo

	CurrentSection  string
	NavigationLinks interface{}
	Title           string

	UserID         uuid.UUID
	UserLoggedIn   bool
	UserHasAccount bool
	HasNews        bool
	Preferences    *db.UserPreference
	CSRFToken      string

	Data ContextData
}

func (*Context) Add

func (c *Context) Add(key string, value interface{})

type ContextData

type ContextData map[string]interface{}

type Pages

type Pages struct {
	// contains filtered or unexported fields
}

Pages holds parsed pages ready for rendering

func LoadPages

func LoadPages() (*Pages, error)

LoadPages parses all web pages found in the pages folder

func (*Pages) RegisterHelpers

func (t *Pages) RegisterHelpers(helpers map[string]interface{})

func (*Pages) Render

func (t *Pages) Render(c echo.Context, name string, data *Context) error

func (*Pages) RenderWithSidebar

func (t *Pages) RenderWithSidebar(c echo.Context, name, sidebar string, data *Context) error

type RequestInfo

type RequestInfo interface {
	// Request returns `*http.Request`.
	Request() *http.Request
	// Scheme returns the HTTP protocol scheme, `http` or `https`.
	Scheme() string
}

RequestInfo is a subset of echo.Context

Jump to

Keyboard shortcuts

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