feat: pass loaded siteConfig as props for React component

This commit is contained in:
endiliey 2018-09-14 23:49:03 +08:00
parent c0194a1f53
commit 11b0d15238
5 changed files with 21 additions and 10 deletions

View file

@ -35,6 +35,17 @@ module.exports = function loadConfig(siteDir, deleteCache = true) {
);
}
/* Fill default value */
const defaultConfig = {
customDocsPath: 'docs',
docsUrl: 'docs'
};
Object.keys(defaultConfig).forEach(field => {
if (!config[field]) {
config[field] = defaultConfig[field];
}
});
/*
User's own array of custom fields,
e.g: if they want to include some field so they can access it later from `props.siteConfig`