diff --git a/src/main/java/run/halo/app/controller/content/model/PostModel.java b/src/main/java/run/halo/app/controller/content/model/PostModel.java index 2c91fb41c..cdb9cfc18 100644 --- a/src/main/java/run/halo/app/controller/content/model/PostModel.java +++ b/src/main/java/run/halo/app/controller/content/model/PostModel.java @@ -75,7 +75,10 @@ public class PostModel { if (post.getStatus().equals(PostStatus.INTIMATE) && StringUtils.isEmpty(token)) { model.addAttribute("slug", post.getSlug()); - return "common/template/post_password"; + if (themeService.templateExists(HaloConst.POST_PASSWORD_TEMPLATE + HaloConst.SUFFIX_FTL)) { + return themeService.render(HaloConst.POST_PASSWORD_TEMPLATE); + } + return "common/template/" + HaloConst.POST_PASSWORD_TEMPLATE; } if (StringUtils.isEmpty(token)) { diff --git a/src/main/java/run/halo/app/model/support/HaloConst.java b/src/main/java/run/halo/app/model/support/HaloConst.java index 1424dc5fc..a68f700b8 100644 --- a/src/main/java/run/halo/app/model/support/HaloConst.java +++ b/src/main/java/run/halo/app/model/support/HaloConst.java @@ -46,11 +46,6 @@ public class HaloConst { */ public final static String HALO_DATA_EXPORT_PREFIX = "halo-data-export-"; - /** - * Static pages pack prefix. - */ - public final static String STATIC_PAGE_PACK_PREFIX = "static-pages-"; - /** * Default theme name. */ @@ -65,6 +60,11 @@ public class HaloConst { * Path separator. */ public static final String FILE_SEPARATOR = File.separator; + + /** + * Post password template name. + */ + public static final String POST_PASSWORD_TEMPLATE = "post_password"; /** * Suffix of freemarker template file */ diff --git a/src/main/java/run/halo/app/service/impl/ThemeServiceImpl.java b/src/main/java/run/halo/app/service/impl/ThemeServiceImpl.java index 8d0fd100a..ba21745cb 100644 --- a/src/main/java/run/halo/app/service/impl/ThemeServiceImpl.java +++ b/src/main/java/run/halo/app/service/impl/ThemeServiceImpl.java @@ -165,6 +165,7 @@ public class ThemeServiceImpl implements ThemeService { Path themePath = Paths.get(themeProperty.getThemePath()); try (Stream pathStream = Files.list(themePath)) { return pathStream.filter(path -> StringUtils.startsWithIgnoreCase(path.getFileName().toString(), prefix)) + .filter(path -> !(HaloConst.POST_PASSWORD_TEMPLATE + HaloConst.SUFFIX_FTL).equals(path.getFileName().toString())) .map(path -> { // Remove prefix String customTemplate = StringUtils.removeStartIgnoreCase(path.getFileName().toString(), prefix); diff --git a/src/main/resources/templates/common/web/readme.ftl b/src/main/resources/templates/common/web/readme.ftl deleted file mode 100644 index 01931ff8c..000000000 --- a/src/main/resources/templates/common/web/readme.ftl +++ /dev/null @@ -1,32 +0,0 @@ -
- ${user.nickname!} -

${blog_title!}

-

- ${blog_url!} -

-
- ---- - -<@postTag method="archiveYear"> -<#list archives as archive> -## ${archive.year?c} -<#list archive.posts?sort_by("createTime")?reverse as post> -- ${post.title!} - - - - -## 分类目录 -<@categoryTag method="list"> -<#list categories as category> -- ${category.name!} - - - -## 标签 -<@tagTag method="list"> -<#list tags as tag> -- ${tag.name!} - - \ No newline at end of file