Skip to content

k.site

Versioned site resources for the current site: pages, layouts, views, scripts, styles, codes, and menus.

Overview

k.site is the unified entry point for structured resources stored in the current site. Use its submodules to create, update, delete, and inspect pages, layouts, views, scripts, styles, code resources, and menus.

Difference from k.file and the CMS file library

  • k.site manages structured site resources with versioning and routing.
  • k.file reads and writes ordinary files in the site directory. See k.file.
  • k.site.files manages versioned resources in the CMS file library. It is separate from ordinary site-directory files exposed by k.file.

Submodule Navigation

MemberDoc
k.site.pagespage.md
k.site.layoutslayout.md
k.site.viewsview.md
k.site.scriptsjs.md
k.site.stylescss.md
k.site.codescode.md — API and CodeBlock resources (codeType)
k.site.menusmenu.md — frontend navigation menus
k.site.runJobjob.md — manually trigger scheduled jobs

Commonly Used Methods

list()

Lists sites accessible to the current signed-in user. This is mainly useful in multi-site automation scenarios. The method requires user and current-organization context and may return null when that context is unavailable.

Parameters: None.

Returns: SiteSummaryViewModel[] | null.

ts
k.api.get("sites", () => {
    return k.site.list() || []
})

diskSpace

Queries the storage used by the site, for example k.site.diskSpace.getSiteSize().

ts
k.api.get("siteSize", () => {
    return k.site.diskSpace.getSiteSize()
})
  • Template Engine — how Layout, Page, and View resources are referenced in HTML
  • k.page — Metadata of the currently rendered page (k.page.setTitle, etc.)
  • k.module — script module context
  • k.label — Multilingual k.t / k.label
  • Admin: Files — CMS file library (not k.file)