diff --git a/src/main/java/run/halo/app/config/WebMvcAutoConfiguration.java b/src/main/java/run/halo/app/config/WebMvcAutoConfiguration.java index d46577754..6f26bcd2e 100644 --- a/src/main/java/run/halo/app/config/WebMvcAutoConfiguration.java +++ b/src/main/java/run/halo/app/config/WebMvcAutoConfiguration.java @@ -29,6 +29,7 @@ import run.halo.app.security.resolver.AuthenticationArgumentResolver; import java.io.IOException; import java.util.List; +import java.util.Properties; /** * Mvc configuration. @@ -120,6 +121,11 @@ public class WebMvcAutoConfiguration implements WebMvcConfigurer { configurer.setTemplateLoaderPaths(FILE_PROTOCOL + haloProperties.getWorkDir() + "templates/", "classpath:/templates/"); configurer.setDefaultEncoding("UTF-8"); + Properties properties = new Properties(); + properties.setProperty("auto_import","/common/macro/common_macro.ftl as common"); + + configurer.setFreemarkerSettings(properties); + // Predefine configuration freemarker.template.Configuration configuration = configurer.createConfiguration(); if (haloProperties.isProductionEnv()) { diff --git a/src/main/java/run/halo/app/controller/content/ContentArchiveController.java b/src/main/java/run/halo/app/controller/content/ContentArchiveController.java index 3af73e910..acb363232 100644 --- a/src/main/java/run/halo/app/controller/content/ContentArchiveController.java +++ b/src/main/java/run/halo/app/controller/content/ContentArchiveController.java @@ -66,7 +66,7 @@ public class ContentArchiveController { * Render post archives page. * * @param model model - * @return template path : theme/{theme}/archives.ftl + * @return template path : themes/{theme}/archives.ftl */ @GetMapping public String archives(Model model) { @@ -77,7 +77,7 @@ public class ContentArchiveController { * Render post archives page. * * @param model model - * @return template path : theme/{theme}/archives.ftl + * @return template path : themes/{theme}/archives.ftl */ @GetMapping(value = "page/{page}") public String archives(Model model, @@ -102,7 +102,7 @@ public class ContentArchiveController { * @param url post slug url. * @param cp comment page number * @param model model - * @return template path: theme/{theme}/post.ftl + * @return template path: themes/{theme}/post.ftl */ @GetMapping("{url}") public String post(@PathVariable("url") String url, diff --git a/src/main/java/run/halo/app/controller/content/ContentCategoryController.java b/src/main/java/run/halo/app/controller/content/ContentCategoryController.java index 582da8b7d..a922db198 100644 --- a/src/main/java/run/halo/app/controller/content/ContentCategoryController.java +++ b/src/main/java/run/halo/app/controller/content/ContentCategoryController.java @@ -49,7 +49,7 @@ public class ContentCategoryController { /** * Render category list page * - * @return template path: theme/{theme}/categories.ftl + * @return template path: themes/{theme}/categories.ftl */ @GetMapping public String categories() { @@ -61,7 +61,7 @@ public class ContentCategoryController { * * @param model model * @param slugName slugName - * @return template path: theme/{theme}/category.ftl + * @return template path: themes/{theme}/category.ftl */ @GetMapping(value = "{slugName}") public String categories(Model model, @@ -75,7 +75,7 @@ public class ContentCategoryController { * @param model model * @param slugName slugName * @param page current page number - * @return template path: theme/{theme}/category.ftl + * @return template path: themes/{theme}/category.ftl */ @GetMapping("{slugName}/page/{page}") public String categories(Model model, diff --git a/src/main/java/run/halo/app/controller/content/ContentIndexController.java b/src/main/java/run/halo/app/controller/content/ContentIndexController.java index ba19b65c1..c3ce7449a 100644 --- a/src/main/java/run/halo/app/controller/content/ContentIndexController.java +++ b/src/main/java/run/halo/app/controller/content/ContentIndexController.java @@ -51,7 +51,7 @@ public class ContentIndexController { * Render blog index * * @param model model - * @return template path: /{theme}/post.ftl + * @return template path: themes/{theme}/index.ftl */ @GetMapping public String index(Model model) { @@ -63,7 +63,7 @@ public class ContentIndexController { * * @param model model * @param page current page number - * @return template path: /{theme}/post.ftl + * @return template path: themes/{theme}/index.ftl */ @GetMapping(value = "page/{page}") public String index(Model model, diff --git a/src/main/java/run/halo/app/controller/content/ContentJournalController.java b/src/main/java/run/halo/app/controller/content/ContentJournalController.java index 513cb5999..925542cfc 100644 --- a/src/main/java/run/halo/app/controller/content/ContentJournalController.java +++ b/src/main/java/run/halo/app/controller/content/ContentJournalController.java @@ -53,7 +53,7 @@ public class ContentJournalController { * Render journal page. * * @param model model - * @return template path: theme/{theme}/journal.ftl + * @return template path: themes/{theme}/journals.ftl */ @GetMapping public String journals(Model model) { @@ -66,7 +66,7 @@ public class ContentJournalController { * * @param model model * @param page current page number - * @return template path: theme/{theme}/journal.ftl + * @return template path: themes/{theme}/journals.ftl */ @GetMapping(value = "page/{page}") public String journals(Model model, diff --git a/src/main/java/run/halo/app/controller/content/ContentSearchController.java b/src/main/java/run/halo/app/controller/content/ContentSearchController.java index 70c2c7610..016533211 100644 --- a/src/main/java/run/halo/app/controller/content/ContentSearchController.java +++ b/src/main/java/run/halo/app/controller/content/ContentSearchController.java @@ -48,7 +48,7 @@ public class ContentSearchController { * * @param model model * @param keyword keyword - * @return template path : themes/{theme}/search + * @return template path : themes/{theme}/search.ftl */ @GetMapping public String search(Model model, @@ -61,7 +61,7 @@ public class ContentSearchController { * * @param model model * @param keyword keyword - * @return template path :themes/{theme}/search + * @return template path :themes/{theme}/search.ftl */ @GetMapping(value = "page/{page}") public String search(Model model, diff --git a/src/main/java/run/halo/app/controller/content/ContentSheetController.java b/src/main/java/run/halo/app/controller/content/ContentSheetController.java index 38c7fb358..b7174fca2 100644 --- a/src/main/java/run/halo/app/controller/content/ContentSheetController.java +++ b/src/main/java/run/halo/app/controller/content/ContentSheetController.java @@ -34,7 +34,7 @@ public class ContentSheetController { /** * Render photo page * - * @return template path: themes/{theme}/gallery.ftl + * @return template path: themes/{theme}/photos.ftl */ @GetMapping(value = "/photos") public String photos() { diff --git a/src/main/java/run/halo/app/controller/content/ContentTagController.java b/src/main/java/run/halo/app/controller/content/ContentTagController.java index b506e5a20..40fa985fb 100644 --- a/src/main/java/run/halo/app/controller/content/ContentTagController.java +++ b/src/main/java/run/halo/app/controller/content/ContentTagController.java @@ -53,7 +53,7 @@ public class ContentTagController { /** * All of tags * - * @return template path: themes/{theme}/tags + * @return template path: themes/{theme}/tags.ftl */ @GetMapping public String tags() { @@ -65,7 +65,7 @@ public class ContentTagController { * * @param model model * @param slugName slug name - * @return template path: themes/{theme}/tag + * @return template path: themes/{theme}/tag.ftl */ @GetMapping(value = "{slugName}") public String tags(Model model, @@ -79,7 +79,7 @@ public class ContentTagController { * @param model model * @param slugName slug name * @param page current page - * @return template path: themes/{theme}/tag + * @return template path: themes/{theme}/tag.ftl */ @GetMapping(value = "{slugName}/page/{page}") public String tags(Model model, diff --git a/src/main/resources/templates/themes/anatole/module/comment.ftl b/src/main/resources/templates/themes/anatole/module/comment.ftl index 70cbbde08..6d10c96ac 100644 --- a/src/main/resources/templates/themes/anatole/module/comment.ftl +++ b/src/main/resources/templates/themes/anatole/module/comment.ftl @@ -1,7 +1,7 @@ <#macro comment post,type> <#if !post.disallowComment!false> - + \ No newline at end of file diff --git a/src/main/resources/templates/themes/anatole/theme.yaml b/src/main/resources/templates/themes/anatole/theme.yaml index 53cf5f148..235adea7e 100644 --- a/src/main/resources/templates/themes/anatole/theme.yaml +++ b/src/main/resources/templates/themes/anatole/theme.yaml @@ -7,4 +7,4 @@ description: A other Halo theme logo: https://avatars1.githubusercontent.com/u/1811819?s=460&v=4 website: https://github.com/halo-dev/halo-theme-anatole repo: https://github.com/halo-dev/halo-theme-anatole -version: 1.0 \ No newline at end of file +version: 1.0