Site
当前访问站点信息
k.site.info.culture
k.site.info.baseUrl
k.site.info.page
k.site.info.setting;
k.site.info.version
提供对站点内主要对象的增删改查, 这些对象包含:
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
如果是需要路由的, 那路由属性名字固定是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是独立的, 通过k.content来提供