From 807feaa99c270015028fb2bab18200688eeb66f5 Mon Sep 17 00:00:00 2001 From: XPoet Date: Sat, 18 Apr 2020 17:35:04 +0800 Subject: [PATCH] feat: overwrite _config.yml using _config.yml in folder source/_data --- scripts/use-source-data.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 scripts/use-source-data.js diff --git a/scripts/use-source-data.js b/scripts/use-source-data.js new file mode 100644 index 0000000..7d48be3 --- /dev/null +++ b/scripts/use-source-data.js @@ -0,0 +1,10 @@ +hexo.on('generateBefore', function () { + const rootConfig = hexo.config; + if (hexo.locals.get) { + const data = hexo.locals.get('data'); + if (data && data._config) { + hexo.theme.config = data._config; + } + } + hexo.theme.config.rootConfig = rootConfig; +}); \ No newline at end of file