mirror of https://github.com/halo-dev/halo
✨ 适配NexT主题
parent
3095b58441
commit
601255a13f
|
@ -72,6 +72,7 @@ public class FrontArchiveController extends BaseController {
|
||||||
if (null == posts) {
|
if (null == posts) {
|
||||||
return this.renderNotFound();
|
return this.renderNotFound();
|
||||||
}
|
}
|
||||||
|
model.addAttribute("is_archives",true);
|
||||||
model.addAttribute("posts", posts);
|
model.addAttribute("posts", posts);
|
||||||
return this.render("archives");
|
return this.render("archives");
|
||||||
}
|
}
|
||||||
|
@ -92,6 +93,7 @@ public class FrontArchiveController extends BaseController {
|
||||||
if (null == posts) {
|
if (null == posts) {
|
||||||
return this.renderNotFound();
|
return this.renderNotFound();
|
||||||
}
|
}
|
||||||
|
model.addAttribute("is_archives",true);
|
||||||
model.addAttribute("posts", posts);
|
model.addAttribute("posts", posts);
|
||||||
return this.render("archives");
|
return this.render("archives");
|
||||||
}
|
}
|
||||||
|
@ -128,6 +130,7 @@ public class FrontArchiveController extends BaseController {
|
||||||
} else {
|
} else {
|
||||||
comments = commentService.findCommentsByPostAndCommentStatusNot(post, CommentStatusEnum.RECYCLE.getCode());
|
comments = commentService.findCommentsByPostAndCommentStatusNot(post, CommentStatusEnum.RECYCLE.getCode());
|
||||||
}
|
}
|
||||||
|
model.addAttribute("is_post",true);
|
||||||
model.addAttribute("post", post);
|
model.addAttribute("post", post);
|
||||||
model.addAttribute("comments", CommentUtil.getComments(comments));
|
model.addAttribute("comments", CommentUtil.getComments(comments));
|
||||||
model.addAttribute("commentsCount", comments.size());
|
model.addAttribute("commentsCount", comments.size());
|
||||||
|
|
|
@ -45,6 +45,7 @@ public class FrontCategoryController extends BaseController {
|
||||||
* @param model model
|
* @param model model
|
||||||
* @return String
|
* @return String
|
||||||
*/
|
*/
|
||||||
|
@GetMapping
|
||||||
public String categories(Model model) {
|
public String categories(Model model) {
|
||||||
List<Category> categories = categoryService.findAllCategories();
|
List<Category> categories = categoryService.findAllCategories();
|
||||||
model.addAttribute("categories", categories);
|
model.addAttribute("categories", categories);
|
||||||
|
@ -87,6 +88,7 @@ public class FrontCategoryController extends BaseController {
|
||||||
}
|
}
|
||||||
Pageable pageable = PageRequest.of(page - 1, size, sort);
|
Pageable pageable = PageRequest.of(page - 1, size, sort);
|
||||||
Page<Post> posts = postService.findPostByCategories(category, pageable);
|
Page<Post> posts = postService.findPostByCategories(category, pageable);
|
||||||
|
model.addAttribute("is_categories",true);
|
||||||
model.addAttribute("posts", posts);
|
model.addAttribute("posts", posts);
|
||||||
model.addAttribute("category", category);
|
model.addAttribute("category", category);
|
||||||
return this.render("category");
|
return this.render("category");
|
||||||
|
|
|
@ -75,6 +75,7 @@ public class FrontIndexController extends BaseController {
|
||||||
if (null == posts) {
|
if (null == posts) {
|
||||||
return this.renderNotFound();
|
return this.renderNotFound();
|
||||||
}
|
}
|
||||||
|
model.addAttribute("is_index",true);
|
||||||
model.addAttribute("posts", posts);
|
model.addAttribute("posts", posts);
|
||||||
return this.render("index");
|
return this.render("index");
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,7 @@ public class FrontPageController extends BaseController {
|
||||||
} else {
|
} else {
|
||||||
comments = commentService.findCommentsByPostAndCommentStatusNot(post, CommentStatusEnum.RECYCLE.getCode());
|
comments = commentService.findCommentsByPostAndCommentStatusNot(post, CommentStatusEnum.RECYCLE.getCode());
|
||||||
}
|
}
|
||||||
|
model.addAttribute("is_page",true);
|
||||||
model.addAttribute("post", post);
|
model.addAttribute("post", post);
|
||||||
model.addAttribute("comments", CommentUtil.getComments(comments));
|
model.addAttribute("comments", CommentUtil.getComments(comments));
|
||||||
model.addAttribute("commentsCount", comments.size());
|
model.addAttribute("commentsCount", comments.size());
|
||||||
|
|
|
@ -83,6 +83,7 @@ public class FrontTagController extends BaseController {
|
||||||
}
|
}
|
||||||
Pageable pageable = PageRequest.of(page - 1, size, sort);
|
Pageable pageable = PageRequest.of(page - 1, size, sort);
|
||||||
Page<Post> posts = postService.findPostsByTags(tag, pageable);
|
Page<Post> posts = postService.findPostsByTags(tag, pageable);
|
||||||
|
model.addAttribute("is_tags",true);
|
||||||
model.addAttribute("posts", posts);
|
model.addAttribute("posts", posts);
|
||||||
model.addAttribute("tag", tag);
|
model.addAttribute("tag", tag);
|
||||||
return this.render("tag");
|
return this.render("tag");
|
||||||
|
|
Loading…
Reference in New Issue