Skip to content

Commit

Permalink
Disable cache when language_switcher is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang committed Jul 16, 2020
1 parent f148857 commit 5d521ca
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scripts/events/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 5d521ca

Please sign in to comment.