From a54c240d70b137f7d79d355015ffb7bde8a1be95 Mon Sep 17 00:00:00 2001 From: ruibaby Date: Wed, 25 Dec 2019 23:39:21 +0800 Subject: [PATCH] feat: support copy static folder when generate static pages. --- .../controller/content/ContentArchiveController.java | 1 - .../halo/app/service/impl/StaticPageServiceImpl.java | 12 +++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) 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 6f28a4c56..d599b9b43 100644 --- a/src/main/java/run/halo/app/controller/content/ContentArchiveController.java +++ b/src/main/java/run/halo/app/controller/content/ContentArchiveController.java @@ -15,7 +15,6 @@ import org.springframework.web.bind.annotation.*; import run.halo.app.cache.StringCacheStore; import run.halo.app.cache.lock.CacheLock; import run.halo.app.exception.ForbiddenException; -import run.halo.app.exception.NotFoundException; import run.halo.app.model.entity.Category; import run.halo.app.model.entity.Post; import run.halo.app.model.entity.PostMeta; diff --git a/src/main/java/run/halo/app/service/impl/StaticPageServiceImpl.java b/src/main/java/run/halo/app/service/impl/StaticPageServiceImpl.java index 73656ba34..9aeade557 100644 --- a/src/main/java/run/halo/app/service/impl/StaticPageServiceImpl.java +++ b/src/main/java/run/halo/app/service/impl/StaticPageServiceImpl.java @@ -128,9 +128,10 @@ public class StaticPageServiceImpl implements StaticPageService { this.generateSiteMapHtml(); this.generateSiteMapXml(); this.generateRobots(); + this.generateReadme(); this.copyThemeFolder(); this.copyUpload(); - this.generateReadme(); + this.copyStatic(); } catch (Exception e) { throw new ServiceException("生成静态页面失败!", e); } @@ -661,6 +662,15 @@ public class StaticPageServiceImpl implements StaticPageService { FileUtils.copyFolder(Paths.get(haloProperties.getWorkDir(), "upload"), path); } + /** + * Copy static folder. + * + * @throws IOException IOException + */ + private void copyStatic() throws IOException { + FileUtils.copyFolder(Paths.get(haloProperties.getWorkDir(), "static"), pagesDir); + } + /** * Build posts for feed *