zh Kooboo Logo Documents

Site

 

Information of the current visited site
 
k.site.info.culture
k.site.info.baseUrl
k.site.info.page
k.site.info.setting;
k.site.info.version
 
 
Providing methods for creating, updating, retrieving, and deleting main objects within the site. These objects include:
 
Page
View
Layout
Style
Script
Code
Image
File
 
 
get
 
let allPages = k.site.pages.all(); 
let view = k.site.views.get("viewname"); 
let page = k.site.pages.getByUrl("/pagename"); 
let style = k.site.styles.getByUrl("/style.css");
 
add
 
If routing is required, the fixed attribute name for routing is "url".
var page = {};
page.name = "pagename";
page.body = "new body";
page.url = "/myurl"
k.site.pages.add(page);
 
update
 
var style = k.site.styles.getByUrl("/a.css");
style.body = ".sample {}";
k.site.styles.update(style);
 
var style = k.site.styles.getByUrl("/a.css"); 
k.site.styles.updateBody(style.Id, ".newcls{}");
 
Delete
 
var page = k.site.pages.getByUrl("/pagename");
k.site.pages.delete(page.id);
 
 
TextContent
 
TextContent is separate and provided through k.content.