From 5d521cab59a1456937cd897980b0c161a1ad8907 Mon Sep 17 00:00:00 2001 From: Mimi <1119186082@qq.com> Date: Thu, 16 Jul 2020 21:18:20 +0800 Subject: [PATCH] Disable cache when language_switcher is enabled --- scripts/events/lib/config.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/events/lib/config.js b/scripts/events/lib/config.js index d3f115c..5e2dc2f 100644 --- a/scripts/events/lib/config.js +++ b/scripts/events/lib/config.js @@ -21,7 +21,12 @@ module.exports = hexo => { hexo.theme.config = merge(hexo.theme.config, hexo.config.theme_config); } - if (hexo.theme.config.cache && hexo.theme.config.cache.enable && hexo.config.relative_link) { + const { cache, language_switcher } = hexo.theme.config; + if (cache && cache.enable && language_switcher) { + hexo.log.warn('Since language_switcher is turned on, the caching is disabled to avoid potential hazards.'); + cache.enable = false; + } + if (cache && cache.enable && hexo.config.relative_link) { hexo.log.warn('Since caching is turned on, the `relative_link` option in Hexo `_config.yml` is set to `false` to avoid potential hazards.'); hexo.config.relative_link = false; }