Documentation
¶
Index ¶
- func GetContentTemplate(content contenttype.ContentTyper, viewmode string, settings SiteSettings, ...) string
- func GetSitePath(r *http.Request) string
- func GetSiteRouters(r *mux.Router) (SiteRouters, SiteRouters)
- func GetSites() []string
- func HandleContent(w http.ResponseWriter, r *http.Request)
- func InitRequest(next http.Handler) http.Handler
- func LoadSite(siteConfig map[string]interface{}) error
- func MatchTemplate(source string, matchData map[string]interface{}, overrideFile string) (string, []string)
- func Output(w io.Writer, variables map[string]interface{}, ctx context.Context) error
- func OutputContent(w io.Writer, id int, siteIdentifier string, sitePath string, ...) error
- func RegisterFunctions(name string, implementation func() TemplateFunctions)
- func RouteContent(siteRouters SiteRouters, defaultRouters SiteRouters)
- func SetSiteSettings(identifier string, settings SiteSettings)
- func TemplateFolder() string
- type NewFunctions
- type RequestInfo
- type SiteRouters
- type SiteSettings
- type TemplateFunctions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetContentTemplate ¶
func GetContentTemplate(content contenttype.ContentTyper, viewmode string, settings SiteSettings, ctx context.Context) string
Get content view template.
func GetSiteRouters ¶
func GetSiteRouters(r *mux.Router) (SiteRouters, SiteRouters)
func HandleContent ¶
func HandleContent(w http.ResponseWriter, r *http.Request)
Handle content, given mux variables: site: <site>, path: <site path>, id: <content id>
func MatchTemplate ¶
func MatchTemplate(source string, matchData map[string]interface{}, overrideFile string) (string, []string)
MatchTemplate returns overrided template based on override rule in template_override.yaml
func OutputContent ¶
func OutputContent(w io.Writer, id int, siteIdentifier string, sitePath string, ctx context.Context) error
Output content using conent template
func RegisterFunctions ¶
func RegisterFunctions(name string, implementation func() TemplateFunctions)
Register a set of functions name: 'namespace' of functions
func RouteContent ¶
func RouteContent(siteRouters SiteRouters, defaultRouters SiteRouters)
Handle contents after initialization
func SetSiteSettings ¶
func SetSiteSettings(identifier string, settings SiteSettings)
func TemplateFolder ¶
func TemplateFolder() string
TemplateFolder() returns folder of templates. eg. under "templates" or "web/templates"
Types ¶
type NewFunctions ¶
type NewFunctions = func() TemplateFunctions
type SiteRouters ¶
type SiteSettings ¶
type SiteSettings struct { Site string TemplateBase string TemplateFolders []string RootContent contenttype.ContentTyper DefaultContent contenttype.ContentTyper Host string Path string }
a basic setting to run a site.
func GetSiteSettings ¶
func GetSiteSettings(identifier string) SiteSettings
type TemplateFunctions ¶
type TemplateFunctions interface { GetMap() map[string]interface{} SetInfo(ctx RequestInfo) }
TemplateFunctions represents a set of functions To register a new set of function, first implement this interface and then invoke RegisterFunctions in init()
Click to show internal directories.
Click to hide internal directories.