feat: overwrite _config.yml using _config.yml in folder source/_data
This commit is contained in:
parent
5ec1f7c8fb
commit
7a93270b46
|
@ -7,18 +7,19 @@ const url = require('url');
|
||||||
/**
|
/**
|
||||||
* Export theme config to js
|
* Export theme config to js
|
||||||
*/
|
*/
|
||||||
hexo.extend.helper.register('export_config', function() {
|
hexo.extend.helper.register('export_config', function () {
|
||||||
let { config, theme } = this;
|
let {config, theme} = this;
|
||||||
let exportConfig = {
|
let exportConfig = {
|
||||||
hostname : url.parse(config.url).hostname || config.url,
|
hostname: url.parse(config.url).hostname || config.url,
|
||||||
root : config.root,
|
root: config.root,
|
||||||
localsearch: theme.local_search,
|
localsearch: theme.local_search,
|
||||||
themeInfo: theme.theme_info
|
themeInfo: theme.theme_info,
|
||||||
};
|
codeblock: theme.codeblock
|
||||||
if (config.search) {
|
};
|
||||||
exportConfig.path = config.search.path;
|
if (config.search) {
|
||||||
}
|
exportConfig.path = config.search.path;
|
||||||
return `<script id="hexo-configurations">
|
}
|
||||||
|
return `<script id="hexo-configurations">
|
||||||
let CONFIG = ${JSON.stringify(exportConfig)};
|
let CONFIG = ${JSON.stringify(exportConfig)};
|
||||||
</script>`;
|
</script>`;
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,7 +15,7 @@ hexo.extend.helper.register('createNewArchivePosts', function (posts) {
|
||||||
postList: []
|
postList: []
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
postList.sort((a, b) => b.year - a.year);
|
postList.sort((a, b) => b.year - a.year)
|
||||||
postList.forEach(item => {
|
postList.forEach(item => {
|
||||||
posts.forEach(post => item.year === post.date.year() && item.postList.push(post))
|
posts.forEach(post => item.year === post.date.year() && item.postList.push(post))
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue