use of jetbrick.template.runtime.InterpretContext in project tale by otale.
the class Theme method meta_description.
/**
* 获取header description
* @return
*/
public static String meta_description() {
InterpretContext ctx = InterpretContext.current();
Object value = ctx.getValueStack().getValue("description");
if (null != value) {
return value.toString();
}
return Commons.site_option("site_description");
}
use of jetbrick.template.runtime.InterpretContext in project tale by otale.
the class Theme method comments.
/**
* 获取当前文章/页面的评论
* @param limit
* @return
*/
public static Paginator<Comment> comments(int limit) {
Contents contents = current_article();
if (null == contents) {
return new Paginator<>(0, limit);
}
InterpretContext ctx = InterpretContext.current();
Object value = ctx.getValueStack().getValue("cp");
int page = 1;
if (null != value) {
page = (int) value;
}
return siteService.getComments(contents.getCid(), page, limit);
}
use of jetbrick.template.runtime.InterpretContext in project tale by otale.
the class Theme method current_article.
/**
* 获取当前上下文的文章对象
*
* @return
*/
private static Contents current_article() {
InterpretContext ctx = InterpretContext.current();
Object value = ctx.getValueStack().getValue("article");
if (null != value) {
return (Contents) value;
}
return null;
}
use of jetbrick.template.runtime.InterpretContext in project tale by otale.
the class Theme method meta_keywords.
/**
* 获取header keywords
* @return
*/
public static String meta_keywords() {
InterpretContext ctx = InterpretContext.current();
Object value = ctx.getValueStack().getValue("keywords");
if (null != value) {
return value.toString();
}
return Commons.site_option("site_keywords");
}
use of jetbrick.template.runtime.InterpretContext in project tale by otale.
the class Theme method head_title.
/**
* header title
* @return
*/
public static String head_title() {
InterpretContext ctx = InterpretContext.current();
Object value = ctx.getValueStack().getValue("title");
String p = "首页";
if (null != value) {
p = value.toString();
}
return p + " - " + Commons.site_option("site_title", "Tale 博客");
}
Aggregations