context

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2018 License: Apache-2.0 Imports: 7 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EngineContext

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

EngineContext provides functions to templates

func NewContext

func NewContext(l logger.Logger, page *models.Page, backend db.Backend, contents map[string]interface{}) *EngineContext

NewContext returns a new EngineContext

func (*EngineContext) Page

func (e *EngineContext) Page() *PageContext

Page returns a PageContext

func (*EngineContext) Site

func (e *EngineContext) Site() *SiteContext

Site returns a PageContext

type PageContext

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

PageContext wraps page related data

func (*PageContext) Content

func (p *PageContext) Content() interface{}

Content is shorthand for accessing page content.

func (*PageContext) CreatedAt

func (p *PageContext) CreatedAt() time.Time

CreatedAt is shorthand for accessing page created at time

func (*PageContext) Data

func (p *PageContext) Data(key string) interface{}

Data returns rendered page data for the given key

func (*PageContext) PublishedAt

func (p *PageContext) PublishedAt() time.Time

PublishedAt is shorthand for accessing page published at time

func (*PageContext) Route

func (p *PageContext) Route() string

Route returns the first route

func (*PageContext) Template

func (p *PageContext) Template() string

func (*PageContext) Theme

func (p *PageContext) Theme() string

func (*PageContext) Title

func (p *PageContext) Title() string

Title is shorthand for accessing page title

func (*PageContext) UpdatedAt

func (p *PageContext) UpdatedAt() time.Time

UpdatedAt is shorthand for accessing page updated at time

type SiteContext

type SiteContext struct {
	*EngineContext
}

SiteContext wraps engine context and provides site related functions.

func (*SiteContext) Data

func (s *SiteContext) Data(key string) interface{}

Data returns rendered site data for the given key

func (*SiteContext) Pages

func (s *SiteContext) Pages() SortablePages

func (*SiteContext) Title

func (s *SiteContext) Title() interface{}

Title is shorthand for accessing site title

type SortablePages

type SortablePages []*PageContext

func (SortablePages) ByPublishedAt

func (p SortablePages) ByPublishedAt() SortablePages

func (SortablePages) Reverse

func (p SortablePages) Reverse() SortablePages

Jump to

Keyboard shortcuts

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