package
0.1.1-beta.2
Repository: https://github.com/digimakergo/digimaker.git
Documentation: pkg.go.dev

# README

DM Sitekit

Sitekit is a toolkit which is used to build sites in a 'template way'.

Core features

  • easy templating
  • multi sites support
  • load multi sites from yaml config file or api, or both.
  • powerful template override based on content conditions
  • nice url(from niceurl package) and extendable
  • extend site router with templating
  • customize template functions, filters, macro

Template engine

The template engine used is pongo2 https://github.com/flosch/pongo2.

Demosite

See Demosite for example use.

Template Functions

Examples:

Fetch content by id:

{%set content = dm.fetch_byid(8)%}

Fetch children:

{%set children = dm.children( content, "article" )%}

Filters

Output variable:

{{var|dmshow}}

Format time to local:

{{timestamp|dm_format_time}}

Template Override

# Packages

No description provided by the author
No description provided by the author
Package niceurl provides nice url feature for dm framework.
No description provided by the author

# Functions

Get content view template, with site setting's template foldertodo: support page content(render content) in matchData, eg.
remove / if path has / in the end.
No description provided by the author
No description provided by the author
No description provided by the author
Handle content, given mux variables: site: <site>, path: <site path>, id: <content id>.
No description provided by the author
No description provided by the author
Initialize sites setting to memory.
MatchTemplate returns overrided template based on override config(eg.
Output proceeds template and output the resultsIf variables includes "content" it will proceed as content,otherwise it process path(eg.
Output content using conent template.
No description provided by the author
OutputString output template result as stringSee Output.
Register a set of functionsname: 'namespace' of functions.
Handle contents after initialization.
No description provided by the author
check if template exists under web/templates(default) folder.
TemplateFolder() returns folder of templates.
add site template folder to template pathif path starts from ~/, use path after ~/.

# Structs

No description provided by the author
a basic setting to run a site.

# Interfaces

TemplateFunctions represents a set of functionsTo register a new set of function, first implement this interface and then invoke RegisterFunctions in init().

# Type aliases

No description provided by the author
No description provided by the author