From e81ed5b66021a8c6b6fe0047079fc3d5c43325c9 Mon Sep 17 00:00:00 2001 From: johnniang Date: Sat, 20 Apr 2019 16:57:13 +0800 Subject: [PATCH] Add theme folder name in theme property --- .../app/handler/theme/config/support/ThemeProperty.java | 7 ++++++- .../java/run/halo/app/service/impl/ThemeServiceImpl.java | 5 ++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/run/halo/app/handler/theme/config/support/ThemeProperty.java b/src/main/java/run/halo/app/handler/theme/config/support/ThemeProperty.java index 6b6f4afa9..947fb139a 100644 --- a/src/main/java/run/halo/app/handler/theme/config/support/ThemeProperty.java +++ b/src/main/java/run/halo/app/handler/theme/config/support/ThemeProperty.java @@ -49,10 +49,15 @@ public class ThemeProperty { private Author author; /** - * Folder name. + * Theme path. */ private String themePath; + /** + * Theme folder name. + */ + private String folderName; + /** * Has options. */ 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 fddffeb1a..7bd8d9a2c 100644 --- a/src/main/java/run/halo/app/service/impl/ThemeServiceImpl.java +++ b/src/main/java/run/halo/app/service/impl/ThemeServiceImpl.java @@ -282,10 +282,8 @@ public class ThemeServiceImpl implements ThemeService { public String render(String pageName) { // Get activated theme ThemeProperty activatedTheme = getActivatedTheme(); - // Get theme folder name - String themeFolderName = Paths.get(activatedTheme.getThemePath()).getFileName().toString(); // Build render url - return String.format(RENDER_TEMPLATE, themeFolderName, pageName); + return String.format(RENDER_TEMPLATE, activatedTheme.getFolderName(), pageName); } @Override @@ -644,6 +642,7 @@ public class ThemeServiceImpl implements ThemeService { // Resolve additional properties themeProperty.setThemePath(themePath.toString()); + themeProperty.setFolderName(themePath.getFileName().toString()); themeProperty.setHasOptions(hasOptions(themePath)); themeProperty.setActivated(false);