mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-09 14:22:27 +02:00
feat: allow custom docsUrl & custom permalink
This commit is contained in:
parent
185f7b1ed1
commit
b99605f725
12 changed files with 270 additions and 177 deletions
|
@ -24,7 +24,9 @@ module.exports = function loadConfig(siteDir, deleteCache = true) {
|
|||
'highlight',
|
||||
'markdownPlugins',
|
||||
'configureWebpack',
|
||||
'chainWebpack'
|
||||
'chainWebpack',
|
||||
'docsUrl',
|
||||
'customFields'
|
||||
];
|
||||
const missingFields = requiredFields.filter(field => !config[field]);
|
||||
if (missingFields && missingFields.length > 0) {
|
||||
|
@ -33,8 +35,16 @@ module.exports = function loadConfig(siteDir, deleteCache = true) {
|
|||
);
|
||||
}
|
||||
|
||||
/*
|
||||
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`
|
||||
*/
|
||||
const {customFields = []} = config;
|
||||
|
||||
/* We don't allow useless/ not meaningful field */
|
||||
const allowedFields = [...requiredFields, ...optionalFields, ...customFields];
|
||||
const uselessFields = Object.keys(config).filter(
|
||||
field => ![...requiredFields, ...optionalFields].includes(field)
|
||||
field => !allowedFields.includes(field)
|
||||
);
|
||||
if (uselessFields && uselessFields.length > 0) {
|
||||
throw new Error(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue