From 2fb8de2f2dfe917591debef85b246f99b0a9b0a8 Mon Sep 17 00:00:00 2001 From: Jared Forsyth Date: Tue, 29 Jul 2014 23:17:16 -0700 Subject: [PATCH] Allow theme config to be overridden by site config If there is a `theme_config` object in the main site config, it is merged into the theme's config. Ex: ```yml \# _config.yml theme_config: bio: "My awesome bio" ``` ```yml \# themes/my-theme/_config.yml bio: "Some generic bio" logo: "a-cool-image.png" ``` results in the following theme config ```js { bio: "My awesome bio", logo: "a-cool-image.png" } ``` --- lib/theme/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/theme/index.js b/lib/theme/index.js index 3dcfb5d1dd..b6dc3efe54 100644 --- a/lib/theme/index.js +++ b/lib/theme/index.js @@ -66,7 +66,7 @@ Theme.prototype._generate = function(options, callback){ config = hexo.config, route = hexo.route, siteLocals = hexo.locals._generate(), - themeLocals = _.extend({}, config, this.config), + themeLocals = _.extend({}, config, this.config, config.theme_config), env = hexo.env, i18n = this.i18n, layoutDir = pathFn.join(this.base, 'layout') + pathFn.sep, @@ -204,4 +204,4 @@ Theme.prototype.getView = function(path){ } else { return views[Object.keys(views)[0]]; } -}; \ No newline at end of file +};