diff --git a/src/main/java/run/halo/app/config/FreeMarkerAutoConfiguration.java b/src/main/java/run/halo/app/config/FreeMarkerAutoConfiguration.java index ab43846ea..89cf5f1f5 100644 --- a/src/main/java/run/halo/app/config/FreeMarkerAutoConfiguration.java +++ b/src/main/java/run/halo/app/config/FreeMarkerAutoConfiguration.java @@ -9,6 +9,7 @@ import run.halo.app.model.freemarker.method.RecentCommentsMethod; import run.halo.app.model.freemarker.method.RecentPostsMethod; import run.halo.app.model.freemarker.tag.*; import run.halo.app.service.OptionService; +import run.halo.app.service.UserService; import javax.annotation.PostConstruct; @@ -28,6 +29,9 @@ public class FreeMarkerAutoConfiguration { @Autowired private OptionService optionsService; + @Autowired + private UserService userService; + @Autowired private PostTagDirective postTagDirective; @@ -59,6 +63,7 @@ public class FreeMarkerAutoConfiguration { public void setSharedVariable() { try { configuration.setSharedVariable("options", optionsService.listOptions()); + configuration.setSharedVariable("user",userService.getCurrentUser().orElse(null)); //Freemarker custom tags configuration.setSharedVariable("categoryTag", categoryTagDirective); configuration.setSharedVariable("commentTag", commentTagDirective); diff --git a/src/main/resources/templates/themes/anatole/category.ftl b/src/main/resources/templates/themes/anatole/category.ftl index 17f31dbf1..aa14c58a7 100644 --- a/src/main/resources/templates/themes/anatole/category.ftl +++ b/src/main/resources/templates/themes/anatole/category.ftl @@ -6,23 +6,23 @@
<#include "module/post_entry.ftl"> - <#if posts.pages gt 1> + <#if posts.totalPages gt 1>