mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-08 13:52:36 +02:00
Enable passing attributes to scripts and links (#937)
This commit is contained in:
parent
2cbfeffd81
commit
969399c6c5
2 changed files with 32 additions and 10 deletions
|
@ -157,7 +157,7 @@ h1 {
|
||||||
|
|
||||||
* `separate` - The secondary navigation is a separate pane defaulting on the right side of a document. See http://docusaurus.io/docs/en/translation.html for an example.
|
* `separate` - The secondary navigation is a separate pane defaulting on the right side of a document. See http://docusaurus.io/docs/en/translation.html for an example.
|
||||||
|
|
||||||
`scripts` - Array of JavaScript sources to load. The script tag will be inserted in the HTML head.
|
`scripts` - Array of JavaScript sources to load. The values can be either strings or plain objects of attribute-value maps. Refer to the example below. The script tag will be inserted in the HTML head.
|
||||||
|
|
||||||
`separateCss` - Directories inside which any `css` files will not be processed and concatenated to Docusaurus' styles. This is to support static `html` pages that may be separate from Docusaurus with completely separate styles.
|
`separateCss` - Directories inside which any `css` files will not be processed and concatenated to Docusaurus' styles. This is to support static `html` pages that may be separate from Docusaurus with completely separate styles.
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ h1 {
|
||||||
|
|
||||||
`scrollToTopOptions` - Optional options configuration for the scroll to top button. You do not need to use this, even if you set `scrollToTop` to `true`; it just provides you more configuration control of the button. You can find more options [here](https://github.com/vfeskov/vanilla-back-to-top/blob/v7.1.14/OPTIONS.md). By default, we set the zIndex option to 100.
|
`scrollToTopOptions` - Optional options configuration for the scroll to top button. You do not need to use this, even if you set `scrollToTop` to `true`; it just provides you more configuration control of the button. You can find more options [here](https://github.com/vfeskov/vanilla-back-to-top/blob/v7.1.14/OPTIONS.md). By default, we set the zIndex option to 100.
|
||||||
|
|
||||||
`stylesheets` - Array of CSS sources to load. The link tag will be inserted in the HTML head.
|
`stylesheets` - Array of CSS sources to load. The values can be either strings or plain objects of attribute-value maps. The link tag will be inserted in the HTML head.
|
||||||
|
|
||||||
`translationRecruitingLink` - URL for the `Help Translate` tab of language selection when languages besides English are enabled. This can be included you are using translations but does not have to be.
|
`translationRecruitingLink` - URL for the `Help Translate` tab of language selection when languages besides English are enabled. This can be included you are using translations but does not have to be.
|
||||||
|
|
||||||
|
@ -251,8 +251,20 @@ const siteConfig = {
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
scripts: ['https://docusaurus.io/slash.js'],
|
scripts: [
|
||||||
stylesheets: ['https://docusaurus.io/style.css'],
|
'https://docusaurus.io/slash.js',
|
||||||
|
{
|
||||||
|
src: 'https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js',
|
||||||
|
async: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
stylesheets: [
|
||||||
|
'https://docusaurus.io/style.css',
|
||||||
|
{
|
||||||
|
href: 'http://css.link',
|
||||||
|
type: "text/css"
|
||||||
|
}
|
||||||
|
],
|
||||||
facebookAppId: '1615782811974223',
|
facebookAppId: '1615782811974223',
|
||||||
facebookComments: true,
|
facebookComments: true,
|
||||||
facebookPixelId: '352490515235776',
|
facebookPixelId: '352490515235776',
|
||||||
|
|
|
@ -137,13 +137,23 @@ class Head extends React.Component {
|
||||||
|
|
||||||
{/* External resources */}
|
{/* External resources */}
|
||||||
{this.props.config.stylesheets &&
|
{this.props.config.stylesheets &&
|
||||||
this.props.config.stylesheets.map(source => (
|
this.props.config.stylesheets.map(
|
||||||
<link rel="stylesheet" key={source} href={source} />
|
source =>
|
||||||
))}
|
source.href ? (
|
||||||
|
<link rel="stylesheet" key={source.href} {...source} />
|
||||||
|
) : (
|
||||||
|
<link rel="stylesheet" key={source} href={source} />
|
||||||
|
)
|
||||||
|
)}
|
||||||
{this.props.config.scripts &&
|
{this.props.config.scripts &&
|
||||||
this.props.config.scripts.map(source => (
|
this.props.config.scripts.map(
|
||||||
<script type="text/javascript" key={source} src={source} />
|
source =>
|
||||||
))}
|
source.src ? (
|
||||||
|
<script type="text/javascript" key={source.src} {...source} />
|
||||||
|
) : (
|
||||||
|
<script type="text/javascript" src={source} key={source} />
|
||||||
|
)
|
||||||
|
)}
|
||||||
|
|
||||||
{this.props.config.scrollToTop && (
|
{this.props.config.scrollToTop && (
|
||||||
<script src="https://unpkg.com/vanilla-back-to-top@7.1.14/dist/vanilla-back-to-top.min.js" />
|
<script src="https://unpkg.com/vanilla-back-to-top@7.1.14/dist/vanilla-back-to-top.min.js" />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue