Skip to content

Template Engine

How Kooboo organizes and renders pages, layouts, views, and routed static assets.

Overview

In Kooboo:

  • Page defines an addressable HTML page.
  • Layout provides the shared page skeleton such as <head>, navigation, and placeholder regions.
  • View is a reusable HTML fragment.
  • Script and Style are independent .js and .css assets with their own site routes.

Server-side data binding is handled through env="server" and directives such as k-content and k-for. Declarative data queries are handled by k-data.

Resource Relationship

LayoutPageSite Assets"head: CDN / importmap / global Style""k-placeholder regions""layout id references Layout""placeholder injects content""view id references View""inline script / page-level logic"View fragmentsScript routesStyle routes
ResourceResponsibilityHas its own URL route?
LayoutShared HTML skeleton and k-placeholder regionsNo
PageURL page, selected layout, injected contentYes
ViewReusable blocks such as headers, cards, and listsNo
ScriptImportable JavaScript and frontend interactionYes
StyleGlobal or page-level stylesheetsYes

Docs In This Section

TopicDescription
LayoutShared shell and placeholder regions
PageStandalone page vs layout-based page
ViewReusable fragments inserted by <view id="...">
ScriptSite JS resources and type="module" usage
StyleSite CSS resources and how they pair with Tailwind
Template Binding Syntaxenv="server", k-content, k-for, and related directives
k-data<k-data>, <query>, and JSON5 conditions

Responsibility Boundaries

ScenarioDoc
Write layout, placeholders, and view references in an HTML templateThis templateEngine/* section
Create, update, or delete site resources with KScript such as k.site.pagesk.site
Render navigation menus with <menu> or k.site.menus + k-fork.site.menus and CMS: Menus
Call external OpenAPI servicesk.openApi and CMS: Open API
Fetch multilingual dictionaries from an SPA frontendSPA Multilingual API and CMS
Build installable modules with routes and view/api resourcesk.module and CMS: Modules
Schedule recurring jobsk.site.runJob and CMS: Scheduled Jobs
Change the current request title or metadatak.page

Data Querying

  • k-data - declarative data flow with let, query, map, and export
  • Historical k-query is deprecated; old URLs redirect to k-data