Fixed 404 or 500 page rendered error.

pull/167/head
ruibaby 2019-05-24 01:15:36 +08:00
parent de6d3d29b9
commit caee1f77a3
3 changed files with 11 additions and 5 deletions

View File

@ -63,4 +63,12 @@ public class MainController {
response.sendRedirect(blogLogo);
}
}
@GetMapping("/favicon.ico")
public void favicon(HttpServletResponse response) throws IOException {
String favicon = optionService.getByProperty(BlogProperties.BLOG_FAVICON).orElse("").toString();
if (StringUtils.isNotEmpty(favicon)) {
response.sendRedirect(favicon);
}
}
}

View File

@ -75,7 +75,7 @@ public class CommonController implements ErrorController {
return "common/error/404";
}
StrBuilder path = new StrBuilder("themes/");
path.append(themeService.getActivatedThemeId());
path.append(themeService.getActivatedTheme().getFolderName());
path.append("/404");
return path.toString();
}
@ -91,7 +91,7 @@ public class CommonController implements ErrorController {
return "common/error/500";
}
StrBuilder path = new StrBuilder("themes/");
path.append(themeService.getActivatedThemeId());
path.append(themeService.getActivatedTheme().getFolderName());
path.append("/500");
return path.toString();
}

View File

@ -12,9 +12,7 @@
<#-- favicon -->
<#macro favicon>
<#if options.blog_favicon??>
<link rel="shortcut icon" type="images/x-icon" href="${options.blog_favicon}">
</#if>
<link rel="shortcut icon" type="images/x-icon" href="${options.blog_favicon!}">
</#macro>
<#-- 站点验证代码 -->