mirror of https://github.com/halo-dev/halo
Support set cdn url instead of base url.
parent
f371ec3e0d
commit
0385dec6ca
|
@ -12,6 +12,7 @@ import run.halo.app.event.options.OptionUpdatedEvent;
|
|||
import run.halo.app.event.theme.ThemeActivatedEvent;
|
||||
import run.halo.app.event.user.UserUpdatedEvent;
|
||||
import run.halo.app.handler.theme.config.support.ThemeProperty;
|
||||
import run.halo.app.model.properties.OtherProperties;
|
||||
import run.halo.app.model.support.HaloConst;
|
||||
import run.halo.app.service.OptionService;
|
||||
import run.halo.app.service.ThemeService;
|
||||
|
@ -98,7 +99,8 @@ public class FreemarkerConfigAwareListener {
|
|||
private void loadThemeConfig() throws TemplateModelException {
|
||||
ThemeProperty activatedTheme = themeService.getActivatedTheme();
|
||||
configuration.setSharedVariable("theme", activatedTheme);
|
||||
configuration.setSharedVariable("static", optionService.getBlogBaseUrl() + "/" + activatedTheme.getFolderName());
|
||||
String baseUrl = optionService.getByProperty(OtherProperties.CDN_DOMAIN).orElse(optionService.getBlogBaseUrl()).toString();
|
||||
configuration.setSharedVariable("static", baseUrl + "/" + activatedTheme.getFolderName());
|
||||
configuration.setSharedVariable("settings", themeSettingService.listAsMapBy(themeService.getActivatedThemeId()));
|
||||
log.debug("Loaded theme and settings");
|
||||
}
|
||||
|
|
|
@ -9,7 +9,9 @@ package run.halo.app.model.properties;
|
|||
*/
|
||||
public enum OtherProperties implements PropertyEnum {
|
||||
|
||||
CUSTOM_HEAD("blog_custom_head",String.class,""),
|
||||
CDN_DOMAIN("blog_cdn_domain", String.class, ""),
|
||||
|
||||
CUSTOM_HEAD("blog_custom_head", String.class, ""),
|
||||
|
||||
STATISTICS_CODE("blog_statistics_code", String.class, "");
|
||||
|
||||
|
|
Loading…
Reference in New Issue