diff --git a/docs/api-site-config.md b/docs/api-site-config.md index af7e1e03d4..e80dad35aa 100644 --- a/docs/api-site-config.md +++ b/docs/api-site-config.md @@ -100,6 +100,8 @@ customDocsPath: "website-docs" `scripts` - Array of JavaScript sources to load. The script tag will be inserted in the HTML head. +`stylesheets` - Array of CSS sources to load. The link tag will be inserted in the HTML head. + `cname` - The CNAME for your website. It will go into a `CNAME` file when your site it built. Users can also add their own custom fields if they wish to provide some data across different files. @@ -162,7 +164,8 @@ const siteConfig = { } } ], - scripts: [ "https://docusaurus.io/slash.js" ] + scripts: [ "https://docusaurus.io/slash.js" ], + stylesheets: [ "https://docusaurus.io/style.css" ] }; diff --git a/lib/core/Head.js b/lib/core/Head.js index 922053bd0b..f11e807ae2 100644 --- a/lib/core/Head.js +++ b/lib/core/Head.js @@ -22,8 +22,6 @@ class Head extends React.Component { const highlightVersion = highlightConfig.version || highlightDefaultVersion; const highlightTheme = highlightConfig.theme || 'default'; - const hasCustomScripts = this.props.config.scripts; - return (
@@ -79,16 +77,23 @@ class Head extends React.Component { /> )} + {/* External resources */} + {this.props.config.stylesheets && this.props.config.stylesheets.map(function(source) { + return ( + + ); + })} + {this.props.config.scripts && this.props.config.scripts.map(function(source) { + return ( + + ); + })} + {/* Site defined code. Keep these at the end to avoid overriding. */} - {hasCustomScripts && this.props.config.scripts.map(function(source) { - return ( - - ); - })} ); }