Detail:
${_post.content.nl2br()}
程序以及基本可用了,需要继续完善页面
1.创建页面模板
创建文件 app/views/tags/display.html
*{ Display a post in one of these modes: 'full', 'home' or 'teaser' }*
修改index.html
#{extends 'main.html' /}
#{set title:'Home' /}
#{if frontPost}
#{display post:frontPost, as:'home' /}
#{if olderPosts.size()}
2.修改Layout views\main.html
renderArgs.put("blogTitle", Play.configuration.getPRoperty("blog.title"));
renderArgs.put("blogBaseline", Play.configuration.getProperty("blog.baseline"));}
加入渲染blog.title blog.baseline
4.修改設定檔confapplication.conf
# Blog engine configuration
# ~~~~~blog.title=Yet t write about anything
運作效果:
${_post.comments.size() ?: 'no'}
comment${_post.comments.size().pluralize()}
#{list items:_post.comments, as:'comment'}
by ${comment.author},
${comment.postedAt.format('dd MMM yy')}
${comment.content.escape().nl2br()}
#{/list}