Skip to content

Commit

Permalink
fix: repaire hexo-config() return value (#170)
Browse files Browse the repository at this point in the history
hexo-config(item) will return empty string '' if item is set as 0 in _config.yml due to (0 || '') is '' in /lib/renderer.js:line 16
And some themes need the value 0 or errors would occurr
  • Loading branch information
kusurin authored Jan 11, 2024
1 parent 560cf83 commit b0024b8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ function getProperty(obj, name) {
let result = obj[key];
const len = split.length;

if (!len) return result || '';
if (!len) {
if(result === 0) return result;
return result || '';
}
if (typeof result !== 'object') return '';

for (let i = 0; i < len; i++) {
Expand Down

0 comments on commit b0024b8

Please sign in to comment.